Hi guys,
I am trying to perform a search based on a given facet that I previously set up in Algolia. Something like this:
if($("#hits").length){
InstantSearch.addWidget(
instantsearch.widgets.hits({
container: '#hits',
hitsPerPage: 10,
facetFilters: [
{"parentCategoryName:Art"}
]
templates: {
item: getTemplate('hit'),
empty: getTemplate('no-results')
}
})
);
}
I don't know if this is meant to be done in "hits" or "searchbox"
Help would be much appreciated!!! Thanks
Hi filimar, I believe what you want is to pre-select a specific filter for your search interface?
The hits widgets has no facetFilters option. You should use this:
var search = instantsearch({
// ... other options
searchParameters: {
facetsRefinements: {
parentCategoryName: ['Art']
}
}
});
let me know
You saved my life dude!! Thanks so much!!
OSS FTW!
Is this documented somewhere?
It is hidden in the Helper documentation, but I just submitted a PR to have a mention of it in the instantsearch documentation.
https://github.com/algolia/instantsearch.js/pull/1027
I'd appreciate your feedback @joshuabaker, to tell me if this is clear enough
Most helpful comment
Hi filimar, I believe what you want is to pre-select a specific filter for your search interface?
The hits widgets has no facetFilters option. You should use this:
let me know