Closed michael-supreme closed 1 year ago
Hi @michael-supreme
Looking at the code, that specific filter is meant more for when using with backend/native search more than Instantsearch. I could be wrong on the potential applicable feasibility of the filter aspect like that.
I do wonder if you maybe need to check out https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/how-to/filter-by-attributes/ and try things out in the format demo'd there.
Otherwise, it may be a case of needing to update/customize the InstantSearch template, perhaps in a similar way as shown at the end of https://github.com/WebDevStudios/wp-search-with-algolia/wiki/WPML
Hey @tw2113, thank you for the link - This helped me get it working with a few minor modifications!
What would be the best method to add a hidden filter to all search results so that in all cases, only certain posts are returned when using the native WordPress + Algolia search template?
I have a
taxonomies.translation_priority
in my index parameters, and I'd like to filter it so that in all cases, only results that equal "Optional" are returned. (I realize I can modify the indexed database, but it's rather large and I'd like to avoid touching it, if possible).I tried placing the following code in my functions.php, with no luck. (Checking the Search API Logs in Algolia shows no filtering of any kind)
Also, to clarify, this is on the search page, not autocomplete (I saw the other post where a user was having a similar issue with autocomplete)