Quite new to Azure Search, and just wondering what is the difference between facet and filter?
Say I have a product table, and it has category and subcategories. If I want to return things under one category, should I use $filter
or use facet? What is the difference between these two?
Many Thanks
Facet results are documents found in the search results that match a facet term. In the following example, in search results for cloud computing, 254 items also have internal specification as a content type. Items aren't necessarily mutually exclusive.
Filters eliminate search results using initial criteria and never change between searches. Facets are used to refine search results using result attributes, and will change depending on the search query.
Facets, also known as facet filters, allow users to refine their searches by multiple dimensions at the same time. Faceted search is a more granular way to find products and results in a specific, targeted way that is not possible with broad, one-size-fits-all filters.
Facet filtering, filtering based on facet values, is a helpful feature for users since it allows them to find specific, targeted results in a way that isn't possible with one-size-fits-all filters. You can combine facet filters with AND (conjunctive) and OR (disjunctive) operators.
Filter is used to restrict which documents are returned by a query. Faceting is used to produce summaries of field values across those documents. Details are here and you can find more general info about how to use faceting and filter together here.
For your specific example, to retrieve documents for one category, use a filter. If you then want to see how many of those documents there are for each sub-category of that category (for example), use facets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With