-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugin-search): added support for reindexing collections on demand #9391
feat(plugin-search): added support for reindexing collections on demand #9391
Conversation
…-search-reindex-collections-2
@akhrarovsaid this looks great! We were wondering if you could modify this PR and place the reindex button in the actions slot for the list view instead of the beforeTable slot? |
Hey @JarrodMFlesch, Thank you! So that was actually my first thought too - it fits more naturally there. However, in my testing there was an issue with the actual dropdown/popup that shows up. I think due to overflow hidden somewhere higher in the dom, it cuts the popup off. I'll try again and report my findings, maybe somethings changed since then. |
There's something about the actions wrapper that does not agree here. Search-Results---Payload.webmHere's what I've tried:
It's strange, I'm doing exactly what the localizer is doing except the localizer isn't wrapped in the actions wrapper, so I'm thinking it must be something conflicting from higher up the dom. I can see the correct active class being applied in devtools on interaction though. |
Is this ready for review again? |
@DanRibbens Yep, good to go |
The transaction is not needed since we execute ```ts const totalDocs = await countDocuments(collection) ``` at the start and previous operations shouldn't affect this count
🚀 This is included in version v3.2.0 |
Thanks for the PR, it's amazing and extremely useful. I'm having issues with large datasets, if one item fails the entire reindexing fails in this case with [18:22:55] ERROR: Error finding search document.
err: {
"type": "MongoExpiredSessionError",
"message": "Cannot use a session that has ended", The other error I seem to be getting is [18:22:54] ERROR: Error finding search document.
err: {
"type": "MongoServerError",
...
"errmsg": "Transaction with { txnNumber: 1 } has been aborted.",
"code": 251,
"codeName": "NoSuchTransaction", I personally feel like there is some underlying issues with transactions that might not be related to this PR. But it is preventing it from functioning correctly. |
…nd (#9391) ### What? This PR aims to add reindexing capabilities to `plugin-search` to allow users to reindex entire searchable collections on demand. ### Why? As it stands, end users must either perform document reindexing manually one-by-one or via bulk operations. Both of these approaches are undesirable because they result in new versions being published on existing documents. Consider the case when `plugin-search` is only added _after_ the project has started and documents have been added to existing collections. It would be nice if users could simply click a button, choose the searchable collections to reindex, and have the custom endpoint handle the rest. ### How? This PR adds on to the existing plugin configuration, creating a custom endpoint and a custom `beforeListTable` component in the form of a popup button. Upon clicking the button, a dropdown/popup is opened with options to select which collection to reindex, as well as a useful `All Collections` option to run reindexing on all configured search collections. It also adds a `reindexBatchSize` option in the config to allow users to specify in what quantity to batch documents to sync with search. Big shoutout to @paulpopus & @r1tsuu for the triple-A level support on this one! Fixes #8902 See it in action: https://github.com/user-attachments/assets/ee8dd68c-ea89-49cd-adc3-151973eea28b Notes: - Traditionally these kinds of long-running tasks would be better suited for a job. However, given how many users enjoy deploying to serverless environments, it would be problematic to offer this feature exclusive to jobs queues. I thought a significant amount about this and decided it would be best to ship the feature as-is with the intention of creating an opt-in method to use job queues in the future if/when this gets merged. - In my testing, the collection description somehow started to appear in the document views after the on-demand RSC merge. I haven't reproduced this, but this PR has an example of that problem. Super strange. --------- Co-authored-by: Sasha <64744993+r1tsuu@users.noreply.github.com> Co-authored-by: Paul Popus <paul@nouance.io>
What?
This PR aims to add reindexing capabilities to
plugin-search
to allow users to reindex entire searchable collections on demand.Why?
As it stands, end users must either perform document reindexing manually one-by-one or via bulk operations. Both of these approaches are undesirable because they result in new versions being published on existing documents. Consider the case when
plugin-search
is only added after the project has started and documents have been added to existing collections. It would be nice if users could simply click a button, choose the searchable collections to reindex, and have the custom endpoint handle the rest.How?
This PR adds on to the existing plugin configuration, creating a custom endpoint and a custom
beforeListTable
component in the form of a popup button. Upon clicking the button, a dropdown/popup is opened with options to select which collection to reindex, as well as a usefulAll Collections
option to run reindexing on all configured search collections. It also adds areindexBatchSize
option in the config to allow users to specify in what quantity to batch documents to sync with search.Big shoutout to @paulpopus & @r1tsuu for the triple-A level support on this one!
Fixes #8902
See it in action:
chrome_2024-11-12_12-18-13.mp4
Notes: