-
Notifications
You must be signed in to change notification settings - Fork 54
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
Allow for filtering index names used. #241
Comments
Draft PR: #273 |
This may need a bit more consideration, as we don't have the filters in places where the prefix is being appended. We're filtering before that point |
I definitely +1 this. My team and I are using the plugin and are looking into indexing different environments within the same application and having the ability to filter the index names would be great for that use case. @tw2113 let me know if you need any help testing as I have a few environments I can use to test w/ some actual non-live data. On avg it's about 10 indexes for various CPTs and including Woo Products |
It won't completely cover the usecase, but I know I have a blog post in review for our WebDevStudios blog about best practices with indexes and also launches. It's not going to document how to change the complete name of indexes being used, but would cover how to handle the prefix portion. In case not known, you're able to set all of the fields in the Settings page with a PHP constant, as documented at https://github.com/WebDevStudios/wp-search-with-algolia/wiki/Constants which could help with multiple environments. |
@aaronware worth trying this out. I just stumbled upon https://github.com/WebDevStudios/wp-search-with-algolia/blob/2.6.1/includes/class-algolia-settings.php#L338-L348 and this has been in the plugin since our initial release. It showed up as I was combing the codebase for actions/filters not documented, as part of #363 Edit: I'm getting unexpected results when using the filter. Needs further investigation. |
It's possible that we may have site owners wanting to switch to using WP Search with Algolia who already have indexes available. However, their naming convention for their indexes may not match what we have generally hardcoded for index IDs.
For example, we default the InstantSearch and Searchable posts Algolia index to
{$prefix_}searchable_posts
https://github.com/WebDevStudios/wp-search-with-algolia/blob/main/includes/indices/class-algolia-searchable-posts-index.php#L387-L397
Meanwhile, for the autocomplete, it's
posts_{$post_type}
,terms_{$taxonomy}
, andusers
respectively, depending on what got indexed there.I suspect that the InstantSearch and Searchable posts index name would be most advantageous.
The text was updated successfully, but these errors were encountered: