Prevent filtering documents on rootPath #6779
Unanswered
indykoning
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
A bit of backstory:
I've used Vue instantsearch to create product pages with category filters, but these categories might not all get indexed due to a "Hide from filters" option which makes sure that category is not added to the index used for filtering.
We manage the currently filtered products using a
category_idswhere we use a hierarchicalList withcategory_lvlxto add filtering for subcategories.When no categories are hidden from the filters it's fine. However when we hide e.g. "men / tops" and navigate to that page we still get a query looking like:
{ ... "filter": [ { "bool": { "should": [ { "term": { "category_lvl2.keyword": "Men > Tops" } } ] } }, { "query_string": { "query": "category_ids:12" } } ], }But
Men > Topsand any level deeper for that category does not actually exist oncategory_lvlxso we get no results, even though it is incategory_idsI'm looking for a way to remove
{ "bool": { "should": [ { "term": { "category_lvl2.keyword": "Men > Tops" } } ] } }from the query when it's the root path, and use the root pathe solely for filtering the filter itself.
Only adding it to the query once it deviates from the root path.
Beta Was this translation helpful? Give feedback.
All reactions