Repository navigation
feat(search): add a --force flag to the search index command - #13449
Open
officialasishkumar wants to merge 2 commits into
Open
officialasishkumar wants to merge 2 commits into
officialasishkumar wants to merge 2 commits into
Conversation
`ocis search index` skips every file that is already indexed and has not changed since the last extraction. After a change that affects the extracted data, such as enabling OCR in Tika, there was no way to index those files again short of deleting the whole bleve index, which makes search unavailable until it has been rebuilt. Add a `force` field to IndexSpaceRequest and a `--force` flag to the command. When set, IndexSpace no longer short-circuits on the stored mtime and extracts and upserts every resource of the requested space or of all spaces. Existing index entries are replaced in place, so search keeps working during the run. The event handlers keep passing false, so their behaviour is unchanged. The Searcher interface gains the force parameter; the generated protobuf code, swagger file and mockery mock are regenerated with the pinned tool versions. Tests cover that an unchanged file is skipped by default and indexed again when forced, and that events never force. Fixes owncloud#9106 Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
LarsJurgensen
approved these changes
Nov 13, 2026
LarsJurgensen
left a comment
Contributor
There was a problem hiding this comment.
Nice work, thank you! 👍
This branch has not been deployed
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.
Description
Adds a
--forceflag toocis search index. Without it nothing changes: files that are already indexed and unchanged are skipped. With it, every file of the given space (or of all spaces with--all-spaces) is extracted and indexed again.Changes:
IndexSpaceRequestgets aforcefield (generated protobuf, swagger and theSearchermock are regenerated with the pinned tool versions).Searcher.IndexSpacetakes aforceparameter; the "already indexed and unchanged" check is bypassed when it is set. The event handlers passfalse.--forceflag on the command, README section and changelog entry.Related Issue
Motivation and Context
After a change that affects the extracted data, e.g. enabling OCR in Tika, already indexed files are never revisited. The only way to rebuild their entries was deleting the bleve database, which leaves search unavailable until it is rebuilt. With
--forcethe entries are replaced in place and stay searchable.How Has This Been Tested?
go test ./services/search/...passesforce; verified that the forced test fails when the!forcecondition is removedIndexSpaceis called withforce=falseforcefieldTypes of changes
Checklist: