Was looking to get confirmation on logic behind facets being both And logic and Or logic. It looks like each field that is set as a facet, the options for that field if selected would receive Or logic. However if you have multiple fields with facets, it becomes And logic for all of those fields.
For example if I was searching for a shirt and I made size, color, and price all facets, I could have within the size medium selected and large selected, for the color red selected and blue selected, and for the price under $25 selected and $25-$50 selected. Based on these selections, the results returned I’m assuming should be either a medium or large size, that it either red or blue, and is either under $25 or between $25 and $50.
Within those options, the Or logic exists, but the And logic comes into play where the results must include an option that was selected from each field. This would mean that a green shirt would not appear in the results even if it is a medium or large size, and under $25 or between $25-$50.
Sorry for the long post and all the thoughts, just want to make sure I have this correct for using Facets for a search flow instead of NLP filters.
Great question. You can check out the documentation on facets here. Below are the key points from the docs to answer your question:
Within a single facet, if multiple options are selected (let’s call them option A and option B) the results will display any entities that contain either option A OR option B.
However, when there are multiple different facets (lets call them facet set 1 and facet set 2), selecting an option in both facet sets 1 and 2 will cause the results to display only entities that contain both selected options from each facet set.
Let us know if that helps clarify.
Thanks for the clarity. Just to confirm with the facet sets cause the documentation doesn’t really address this scenario fully.
Back to the shirt example. If Facet set 1 is sizes and Facet set 2 is colors. Your first point makes sense that if I did large and medium in facet set 1 it would show me any option that is a large or medium. Independently if I did blue and green for facet set 2 it would show me any option that was blue or green.
For your second point when you combine them they need to include both selected options. Confirming this means I would have 4 combinations: 1) Large Blue 2) Medium Blue 3) Large Green 4) Medium Green. With the logic of our facets, entities that are returned would just need to follow under any of those 4 combinations correct?
Sorry for all the direct specifics, just want to make sure I have this right since this would be leveraged with a guided search experience that is considering multi option selects in their questionnaire.
Your understanding is correct; our default facet logic is to OR join within a facet, and AND join between facets. So Large AND Blue, Medium AND Blue, etc. That could also be Large AND (Blue OR Red), if you select multiple values in the color facet for example.
This is pretty standard facet behavior across most search engines, but we have considered adding the ability to customize this logic.