Skip to content
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): reindex collections #9391

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

akhrarovsaid
Copy link
Contributor

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 for the triple-A level support on this one!

Fixes #8902

See it in action:

chrome_2024-11-12_12-18-13.mp4

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant