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

[4.x] Add autocreate_on_save option for indexes #8866

Closed
wants to merge 1 commit into from

Conversation

j6s
Copy link
Contributor

@j6s j6s commented Oct 18, 2023

Statamic updates search indexes automatically, when an entry is saved. This includes creating a new index and filling it up completely, if none exists.

This is great for smaller sites, since one does not have to worry about the index at all - however, on larger sites with a lot of content and/or custom search indexers, that take a while to complete, this can end in a situation, where saving an entry is impossible due to the index creation.

This PR adds a autocreate_on_save option for indexes, which defaults to true.

  • If autocreate_on_save is set to true then the current behaviour is preserved
  • If autocreate_on_save is set to false, then the index will be updated, if it already exists but it will not be automatically created, should it not exist. If the option is enabled, the index has to be created using other means (e.g. manually via CLI, cronjob, ...)

Future outlook:

When this question originally was raised by my colleague, moving this work to a queue was also raised as an alternative. In my opinion, this would be a better solution altogether

2023-10-18_12-18

@j6s j6s changed the title Add autocreate_on_save option for indexes [4.x] Add autocreate_on_save option for indexes Oct 18, 2023
@j6s j6s force-pushed the feature/index-auto-creation branch from 89e4514 to 61418f0 Compare October 18, 2023 11:31
@ebeauchamps
Copy link
Contributor

Alternative for #8867

@jasonvarga
Copy link
Member

Thank you for this, but I believe the queued solution to be a better fit.

@jasonvarga jasonvarga closed this Oct 18, 2023
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.

3 participants