owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.36k stars 180 forks source link

search: force re-index command #9106

Open wkloucek opened 4 months ago

wkloucek commented 4 months ago

Is your feature request related to a problem? Please describe.

I want to force the search service to rebuild the search index for a space / all spaces. This can currently only be done by deleting the bleve database because search tries to outsmart me and says:

ocis-1       | {"level":"debug","service":"search","path":".","time":"2024-05-08T12:48:54Z","line":"github.com/owncloud/ocis/v2/services/search/pkg/search/service.go:419","message":"Walking tree"}
ocis-1       | {"level":"debug","service":"search","path":".","time":"2024-05-08T12:48:54Z","line":"github.com/owncloud/ocis/v2/services/search/pkg/search/service.go:427","message":"subtree hasn't changed. Skipping."}
ocis-1       | {"level":"debug","service":"search","count":2,"time":"2024-05-08T12:48:54Z","line":"github.com/owncloud/ocis/v2/services/search/pkg/search/search.go:67","message":"new document count"}

What it doesn't know: I might have enabled OCR on the Tika side in the meantime.

Describe the solution you'd like

Introduce a --force option, eg. ocis search index --force. It would do the reindexing even there were no changes detected.

Describe alternatives you've considered

Deleting the whole bleve database. But that creates a downtime of the search index until it has been completely rebuilt. The proposed solution could work in place / only have a search "downtime" for the space we're re-indexing.

Additional context

search service re-index using service account: https://github.com/owncloud/ocis/issues/9103

mmattel commented 4 months ago

Referencing: #5515 (Improve the search service index management)