feat(search): add ocis search optimize CLI command#12136
Open
paul43210 wants to merge 3 commits intoowncloud:masterfrom
Open
feat(search): add ocis search optimize CLI command#12136paul43210 wants to merge 3 commits intoowncloud:masterfrom
ocis search optimize CLI command#12136paul43210 wants to merge 3 commits intoowncloud:masterfrom
Conversation
|
mmattel
reviewed
Mar 25, 2026
Add a standalone command to compact the search index by merging bleve segments without re-indexing content. This is useful for existing instances where the index has accumulated many small segments from incremental writes. The command sends an OptimizeIndex gRPC call to the running search service, which triggers bleve's ForceMerge. Previously, optimization only ran at the end of `ocis search index`, requiring a full space walk even when the index was already up to date. Usage: ocis search optimize Proto changes use google.protobuf.Empty for request/response types. Generated files were hand-edited to match — regenerate with buf if needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move emptypb import to sort alphabetically with other google.golang.org imports, fixing SonarCloud gofmt violation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix changelog reference PR number
577b800 to
8658473
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
ocis search optimizeCLI command that compacts the Bleve search index by merging segments (ForceMerge), improving query performance without re-indexing contentgoogle.protobuf.Emptyfor theOptimizeIndexRPC to avoid creating new message typesBackground
After bulk re-indexing (e.g.
ocis search index), the Bleve index can accumulate many small segments that degrade query performance. Currently the only way to compact them is programmatically via theForceMergeAPI added in #12104. This PR exposes that capability as a simple CLI command so administrators can trigger optimization on demand.Requested by @mklos-kw in the context of #12104.
Changes
search.protoOptimizeIndexRPC (Empty → Empty)search.pb.micro.gosearch.pb.web.goservice.go(search)OptimizeIndextoSearcherinterface + implementationservice.go(grpc)Searcher.OptimizeIndexoptimize.goroot.goOptimizein command listmocks/changelog/Usage
ocis search optimize # Output: index optimization completeTest plan
make -C services/search test— all 35 tests pass🤖 Generated with Claude Code