-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
[5.x] Provide search index name callback #10435
base: 5.x
Are you sure you want to change the base?
Conversation
Ah yes, sure. I am not that config-file fan any more but as Statamic has a lot of config files it would fit too. Also keep in mind that there are other search providers as well. Narrowing down this to Algolia could lead to other PR's :) |
Good point! |
I went the config file road in the other PR because that's the way it is done in Laravel Scout. In the end it's more about having the opportunity to have the value in your env file. It doesn't have to be in the |
I'm sure some folks are tied up with Laracon/traveling, but happy to help support this in any way! We're about to work on a project that needs this type of capability. Any documentation necessary here? I can write that up if so if it'll help get this merged sooner! |
You can always composer patch it in. |
Good idea, @edalzell! In the meantime, if the core team could use an extra pair of hands I'm happy to jump in! |
Hi @jasonvarga. I added a test for the search index name callback. This somehow took longer as expected as the Please let me know if this works for you and if there is anything missing. Thanks! |
Currently Statamic always generates search index names like this
$locale ? $name.'_'.$locale : $name
.When using different environments (staging, production) and a cloud search provider (e.g. Algolia) index names tpyically collide. Staging updates overwrite those from production and vice versa.
At least in the lower pricing plans Algolia has a limit of 1 app per account and per app isolation is also often a configuration overhead. So an environment prefix for the search index name would be handy?
Afaik there a two approaches to get this solved in user land:
search.php
With this PR it would possible to override the generating of index names by setting a callback within a ServiceProvider's boot method e.g. like this:
No breaking chances, default name generation is preserved.
Any chance that this is getting merged? :)
Thanks!
Closes statamic/ideas#1202