* feat(search): add a --timeout flag to the index command
ocis search index called the search service with a hard-coded 10 minute
request timeout. The service walks the whole space inside that request, so
when the timeout expired the walk was cancelled (error walking the tree:
context canceled) and everything after that point stayed unindexed. A space
whose walk takes longer than ten minutes could never be fully indexed from
the command line.
The timeout is now a flag: --timeout takes a duration, default 10m so the
behaviour is unchanged out of the box; 0 waits indefinitely (go-micro treats
a zero RequestTimeout as an already-expired deadline, so a far-off one is
substituted).
Fixes#13052
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Paul Faure <paul@faure.ca>
* docs(search): say the index command needs the running search service
The index command is a gRPC client of the search service and never opens
the Bleve index, so it works with the default exclusive lock
(SEARCH_ENGINE_BLEVE_SCALE=false) but needs the service running.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT
Signed-off-by: Paul Faure <paul@faure.ca>
---------
Signed-off-by: Paul Faure <paul@faure.ca>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* fix: the public share configuration and fixed graceful shutdown
* fix: [OCISDEV-1433] remove GRPC_MAX_CONNECTION_AGE
The setting closed healthy grpc connections on a timer so that clients would redo
their DNS lookup. It never helped against the failure it was reached for - a
connection whose peer stopped answering - because the age limit is enforced by
the server, the grace period was left at infinity so a request already in flight
was never ended, and any value without a unit suffix silently disabled it again.
Detecting a peer that stops answering is now the job of the grpc clients, which
ping the peer while a request is in flight. The servers here got the matching
enforcement policy so they accept those pings; the client side arrives with the
next reva bump.
* fix: Added the new variable OCDAV_DISABLE_PROPFIND_PUBLIC_LINK_RESOLUTION that disable the resolution of public link shares when answering PROPFIND requests.
* chore: bump reva
* fix: The keepalive added to grpc clinet
* chore: bump reva
* build(deps): bump go 1.26.8, grpc-go dependency
---------
(cherry picked from commit e86eb4d210)
For the 9.0 branch, the reva dependency was pointed at reva's main-branch
merge of PR #748 (commit 373f9509a, pseudo-version
v2.0.0-20261005091647-373f9509a363) instead of the 8.2-targeted
e0beaa380005, since the 8.2 merge predates the VaultMode/UploadSessionFilter.Orphaned
APIs already present on the 9.0 reva lineage.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts:
# changelog/unreleased/security-bump-grpc.md
# go.mod
# go.sum
# vendor/google.golang.org/grpc/server.go
# vendor/google.golang.org/grpc/stream.go
# vendor/google.golang.org/grpc/version.go
# vendor/modules.txt
* feat: metadata autopropagation
* feat: autoprop support for MFA / vault mode
* fix: replace some http clients with reva ones
* chore: required lib update
* fix: adjust unit tests and generate new mocks
* fix: apply autopropagation to all regular graph routes
* chore: updated reva dependency
* fix: return the right decorator for the thumbnails
* fix: remove autopropagation headers in the proxy
Add regression coverage for case-insensitive wildcard queries on photo
keyword fields, protecting PR #12078 (the lowercaseKeyword analyzer fix).
Only the Name field previously had a case-insensitive test; the photo
fields that #12078 fixed had none.
- bleve_test.go: integration spec indexing cameraMake="Canon" and
asserting canon/Canon/*Canon*/*canon* all return 1 hit. The uppercase
wildcard form is what the advanced-search web extension actually sends.
- compiler_test.go: unit case asserting photo.cameraMake:*Canon* compiles
to photo.cameraMake:*canon*, pinning the query-side strings.ToLower
independent of the index.
Signed-off-by: Paul Faure <paul@faure.ca>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Martin <github@diemattels.at>
* feat: Implemet the vault-storage
feat: Separate the storage-users and graph to handle
feat: move the space create cache
configurate the vault srorage Postprocessing
hide the assignment of the MountID to VaultStorageProviderID behind a flag to avoid the ID mismatch
configurate the proxy to create the vault home space
update the filter
Make the graph able to handle vault prefix. no extra service needed
apply the vault filter to sharedbyme and sharedwithme
added vault-storage docker
use squashed reva
fix the finishUpload event
restict webdav copy/move from the vault
feat: provide the mfa to webdav and grpc
feat: refactoring: provide the mfa to webdav and grpc
mfa collaboration
fix GetRootDriveChildren and more
fix: send the MFA header in HTTP clients from the collaboration service
provide the default storage user vault configuration
update create_home middleware
Update deployments/examples/ocis_full/vault-storage.yml
Co-authored-by: Martin <github@diemattels.at>
Update services/gateway/pkg/config/config.go
Co-authored-by: Martin <github@diemattels.at>
Update services/graph/pkg/config/config.go
Co-authored-by: Martin <github@diemattels.at>
Update services/graph/pkg/config/config.go
Co-authored-by: Martin <github@diemattels.at>
Update services/storage-users/pkg/config/config.go
Co-authored-by: Martin <github@diemattels.at>
Update services/proxy/pkg/config/config.go
Co-authored-by: Martin <github@diemattels.at>
Update services/storage-users/pkg/config/config.go
Co-authored-by: Martin <github@diemattels.at>
Update deployments/examples/ocis_full/vault-storage.yml
Co-authored-by: Martin <github@diemattels.at>
bump reva
deduplicate the requireMFA middeware on vault routes. fix AppendPlainToOpaque.
added the changlog and comments
* feat: add the vault mode search
* Update changelog/unreleased/enhancement-vault-storage.md
Co-authored-by: Martin <github@diemattels.at>
* update the readme. the reva vault storage provider configuration disabled by default
* feat: [OCISDEV-531] add vault capabilities to the OCS capabilities endpoint
* the port range allocated. the configuration updated.
---------
Co-authored-by: Martin <github@diemattels.at>
During IndexSpace bulk reindexing, file extraction is now retried up to
5 times with a 1-second delay between attempts. If 5 consecutive files
fail (indicating the extraction service is down), the walk is aborted.
This replaces the previous 30-minute exponential backoff approach per
review feedback from jvillafanez: keep retries quick and short, return
an error to the admin rather than sleeping for extended periods.
No interface changes — retry logic is internal to the service.
Signed-off-by: Paul Faure <paul@faure.ca>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Add a CLI-only optimize command that compacts the Bleve search index by
merging segments. The command opens the index directly via a new engine
factory (NewEngineFromConfig), without requiring the running gRPC service.
Key changes per review feedback from jvillafanez:
- CLI-only: no gRPC endpoint, no proto changes — admin triggers it
directly when disruption is acceptable
- Engine factory: extracted engine creation from the gRPC handler into
NewEngineFromConfig, reusable by both the service and CLI commands
- Optimize() merged into Engine interface: no separate Optimizer
interface, non-supporting engines can return an error
Signed-off-by: Paul Faure <paul@faure.ca>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Martin <github@diemattels.at>
Increases the "descends into already-indexed directories" test from 100
to 10,000 directories. Restructures mocks to use map-based dispatch
instead of per-directory mock.MatchedBy registrations, keeping the test
at O(n) instead of O(n²).
Result: 10,000 already-indexed dirs with 10,000 unindexed child files
completes in ~14 seconds, confirming linear scaling.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verifies that IndexSpace visits children inside 100 already-indexed
directories whose mtimes match the index. Before the SkipDir fix
these subtrees would be permanently skipped after an interrupted
reindex run.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The SkipDir optimization skipped entire subtrees when a directory was
already indexed with a matching mtime. After a failed indexing run
(e.g. Tika crash), this permanently prevented unindexed children from
being visited since the parent directory's mtime doesn't change when
child extraction fails. With O(1) DocID lookups the per-file skip
check is negligible, making SkipDir unnecessary for correctness.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the per-file Search() call in IndexSpace with a direct Lookup()
using Bleve's DocIDQuery. The old approach parsed a KQL query string,
compiled it, and ran a full-text search for each file — taking 600-950ms
per file on large indexes. The new approach does an O(1) document lookup
by ID and compares mtime/Extracted fields in memory.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add an Optimizer optional interface and Bleve.Optimize() method that
triggers ForceMerge to compact all index segments into one. Called
automatically after IndexSpace completes its walk. Over time, writes
create multiple segments that degrade query performance — compaction
consolidates them for faster searches.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extracts DateTimeNode handling into dateTimeQuery(), same pattern as
numericQuery(). Brings walk() cyclomatic complexity from 36 to ~30,
well below the SonarCloud threshold of 35.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two changes to fix permanently stuck index entries:
1. (Option D) Validate Tika responses: if MetaRecursive() returns an
empty metadata list, treat it as an error. This prevents Tika HTTP 200
responses with no actual content from being accepted as successful
extractions.
2. (Option B) Add Extracted field to Resource: a boolean that is set to
true only when UpsertItem completes successfully. The IndexSpace skip
check now requires Extracted:true in addition to matching id+mtime.
Documents that were written with incomplete extraction data will be
automatically re-processed on the next reindex.
Background: When Tika returns HTTP 200 but its child processes (OCR,
ImageMagick) fail due to resource limits (EAGAIN, OOM), the Go Tika
client receives metadata headers but no X-TIKA:content. The doc gets
written to Bleve with the correct mtime, and subsequent reindexes skip
it forever because the id+mtime check passes.
Fixes: #12093
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes SonarCloud gocyclo finding — walk() cyclomatic complexity
was 40 (threshold 35). Extracted numeric range query building
into a separate numericQuery() function.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add NumericRestrictionNode to the KQL PEG grammar so that range
operators work with numeric values, not just DateTimes. This enables
queries like `size>=1048576`, `photo.iso>=100`, `photo.fNumber>=2.8`,
and `photo.focalLength<50`.
Changes:
- ast: add NumericNode with Key, Operator, Value (float64)
- kql/dictionary.peg: add NumericRestrictionNode and Number rules
- kql/factory.go: add buildNumericNode()
- kql/cast.go: add toFloat64()
- bleve/compiler.go: compile NumericNode to NumericRangeQuery
Fixes: #12093
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- UpdateTags now updates only the tags field instead of all basic
metadata (name, size, mimetype, path, parentID), per reviewer
feedback that those are structural fields not metadata.
- Removed refreshMetadata helper that was over-reaching.
- Introduced ErrResourceNotFound sentinel in engine package so
UpdateTags can distinguish "not indexed" (fallback to UpsertItem)
from connectivity or other errors (log and stop).
- Added GoDoc example for the Update mutateFn callback.
- Added test for non-retriable error path.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address reviewer feedback:
- Remove checksum field from index (bloats index, not searched)
- Remove skipUnchangedContent guard (not needed with UpdateTags path)
- Replace engine.Retrieve() with engine.Update(id, mutateFn) that does
get+mutate+set internally, avoiding public exposure of raw retrieval
- Simplify UpdateTags to use engine.Update() with mutation function
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Moves the metadata-storage block from UpsertItem into a dedicated helper
method to bring cognitive complexity below the SonarCloud threshold of 15.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move the checksum fast-path logic into a dedicated helper method to
bring UpsertItem below the SonarCloud cognitive complexity threshold
of 15.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add tests for:
- UpsertItem skips Tika when checksum unchanged
- UpsertItem runs Tika when checksum differs
- UpsertItem runs Tika when resource not yet indexed
- UpdateTags preserves Tika content when resource is indexed
- UpdateTags falls back to full UpsertItem when not indexed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tag events (TagsAdded/TagsRemoved) previously called UpsertItem which
triggered a full Tika content extraction for metadata-only changes.
Additionally, UpsertItem's SetArbitraryMetadata writeback bumped the
mtime, causing IndexSpace to call UpsertItem again — running Tika
twice per file. On servers with large libraries this caused a
denial-of-service from runaway convert/tesseract processes.
Fix by:
- Adding UpdateTags() to the Searcher interface for tag-only updates
that preserve existing Tika-extracted content
- Adding Retrieve() to the Engine interface to load indexed resources
- Comparing the content checksum (already computed by decomposedfs on
upload) in UpsertItem to skip Tika and the metadata writeback when
the blob has not been written to
- Extracting refreshMetadata() helper shared by both code paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Addresses SonarCloud goconst finding — the string "lowercaseKeyword"
appeared 4 times without a named constant.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bleve's query string parser lowercases search terms, but the keyword
analyzer stores values as-is. This made photo field searches like
cameraMake:google fail to match "Google". Switch from keyword to
lowercaseKeyword analyzer so both sides are lowercased.
Note: existing Bleve indexes need to be rebuilt after this change.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Send truncated stream via io.LimitReader instead of skipping Tika
entirely for files exceeding ContentExtractionSizeLimit. EXIF metadata
lives in the JPEG header, so even a truncated read extracts all photo
data from large files like Pixel Motion Photos.
Also prefer the standard exif:IsoSpeedRatings field over the Canon-
specific "Base ISO", falling back to the latter when absent.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add exposure numerator/denominator to search results
- Add altitude extraction from Tika GPS metadata
- All photo EXIF fields now fully exposed via WebDAV search
- Add location field mappings with Store=true in Bleve index
- Rename properties to oc:photo-location-* for consistency
- Add altitude support alongside latitude/longitude
- Requires index rebuild to take effect
This change enables photo gallery applications to access EXIF metadata
through the search API.
Changes:
- Add KQL query support for photo fields:
- photo.takenDateTime (datetime range queries)
- photo.cameraMake, photo.cameraModel (keyword queries)
- photo.fNumber, photo.focalLength, photo.iso (numeric queries)
- Configure Bleve index to store photo fields (Store=true)
- Map photo metadata from Bleve hits to Entity.Photo protobuf
- Add oc:photo-* properties to WebDAV search responses
- Add unit tests for photo field queries
The photo metadata is extracted by Tika during indexing and stored
in the Bleve search index. This enables queries like:
photo.takenDateTime:[2023-01-01 TO 2023-12-31]
photo.cameraMake:Canon
Signed-off-by: Paul Faure <paul@faure.ca>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The "tracing.GetNewRequest" and "tracing.GetNewRequestWithContext" aims
to replace the "http.NewRequest" and "http.NewRequestWithContext"
respectively by including tracing data.
For requests that have been already created, such as the case of some
reva requests, "tracing.InjectTracingHeaders" is provided.
Note that some outgoing requests might be required NOT to use tracing
headers.