Attributes for Faceting - Relevant to search query

Hi, I’m Diogo and I’m currently working with a retailer using Algolia on its website.

I’m still exploring some of Algolia’s features with still a LOT to learn.

I’ve figured that for all search queries, we’re getting only 3 facetting options:
“Price Range, Category and Brand”.

I was wondering if and how it would be possible to have more facetting options that would be relevant to the Search query, i.e, if one searched for “Laptop” he/she would get “CPU, RAM, Storage, etc” or if searched for"Books" something like “Author, Genre, etc.”

How can the Search Engine be “smart” enough to adapt the facetting options to the search query?

Thanks :slight_smile:

Hi Diogo,

Thanks for reaching out to Algolia.

I am not sure I exactly understand your use case, so don’t hesitate to correct me if I am mistaken.
You are trying to add more faceting options to the retailer’s website in order to offer more control to their users on their search. The issue here is that the store offers various types of products and it might not make sense to have all the facets being present at all time, e.g. you don’t want to have CPU, RAM, Storage facets when searching for books. Is that correct?

If so, I may have an idea to help you realise what you want to achieve. The idea is to only display a facet filter only if it represents a large share of the hits for the current query. The idea would be to have all the facet filters loaded with InstantSearch but being hidden away by default, and only displaying them when they go over a certain threshold. You can calculate if a facet goes over that threshold by accessing the facet count for each value of the facet. This information is provided in the response of each query (it’s how InstantSearch knows how many hits there are in each facet values). I think you can access that data through the use of either the searchFunction feature of InstantSearch, or the searchClient feature, which more advanced but also offers more control.

Let me know if this helps you solve your issue.

Hi Jonathan!

Well, yeah, sorry if the explanation was not precise but you got it right!

Thank you for the feedback, I’ll share this info with my tech team and if needed I’ll come back to you.