Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

feat: Force Reindex Collections #9

Closed as not planned
Closed as not planned

Description

@matthijs166

Currently, there is no functionality in the Payload Search Plugin to force reindexing of collections. This means that if there are changes in the related data, such as a change in the name of a category, the search index will not be automatically updated. To ensure that the search index reflects the updated data, a manual reindexing feature needs to be implemented.

Proposal:
I propose adding a new feature to the Payload Search Plugin that allows users to force reindexing of collections. This feature would trigger the reindexing process for a specific collection or for all enabled collections. Enabeling this option in de plugin config and adding in the admin UI an interface to run the sync with error handling and logging mechanisms to handle any issues that may occur during the reindexing process.

With this new feature, users will have the ability to manually trigger reindexing of collections, ensuring that any changes in related data are reflected in the search results.

This is also an handy feature when this plugin is later added to a large collection. (we now have to manual update each item 80+)

Activity

  1. changed the title [-]Force Reindex Collections[/-] [+]feat: Force Reindex Collections[/+] on Jul 5, 2023
  2. jacobsfletch commented on Jul 10, 2023

    @jacobsfletch
    Member

    Hey @matthijs166 yep I see what you mean. Because this plugin should not rely on relationships by design, your search documents are not always up-to-date. This means you'd have to navigate into an already indexed page and resave it. Is this what you're experiencing? This sounds like a great feature. Here's how we'd probably implement it:

    1. render a custom button on the list view of each search-enabled collection
    2. add a custom endpoint that this button can hit
    3. iterate through every search document and query its parent doc for fresh data
    4. run the results through the beforeSync hook
    5. programmatically save each document

    What do you think?

  3. matthijs166 commented on Jul 11, 2023

    @matthijs166
    Author

    Hey @matthijs166 yep I see what you mean. Because this plugin should not rely on relationships by design, your search documents are not always up-to-date. This means you'd have to navigate into an already indexed page and resave it. Is this what you're experiencing?

    Yes, that's exactly right!

    This sounds like a great feature. Here's how we'd probably implement it:

    1. render a ....

    This sounds like a great solution. Maybe we can implement a progress bar to, so that we can see the progress.

    An intern API would also be awesome: An function to pass a list of ID's to reindex. Handy to implement direct sync with a hook. For example, I'm updating a categorie and in the afterChange hook fetch all dependent items and sync them with this function.

    The API endpoint can also be used for cronjobs, maybe a cool idea to add it in the docs.

  4. jacobsfletch commented on Dec 13, 2023

    @jacobsfletch
    Member

    This plugin is now being maintained in the Packages Directory of the Payload Monorepo. This repo will soon be archived and all open issues including this one will be closed. This issue has already been added to this open discussion, though, so that it will not get lost. Please refer to that discussion for more details and to continue the conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions