November Happy Hour will be moved to Thursday December 5th.

Multi-select faceting

Vote:
 

Hello,

I'm having a challenge figuring out how to do multi select faceting with Episerver Find, when terms under different facets are selected. I will try to explain what I am doing and what I want to achive.

All the selections under the same facet is grouped together as OR and AND between them.

Adding a Color and a Size terms facet to my query I get the following result.

searchQuery = searchQuery.TermsFacetFor(x => x.ColorValue);
searchQuery = searchQuery.TermsFacetFor(x => x.SizeValue);
  === Color ===		   === Size===
[ ] Blue (40) [ ] Large (70)
[ ] Red (50) [ ] Medium (100)
[ ] Green (60) [ ] Small (50)
[ ] Yellow (70)


I then apply a Red Color Facet using the Filter Extension, which is not what i want, because it excludes all the other colors from the facet result, and does not reflect that the user can OR between them.

=== Color === === Size===
[ ] Blue (0) [ ] Large (15)
[X] Red (50) [ ] Medium (20)
[ ] Green (0) [ ] Small (15)
[ ] Yellow (0)


If I instead use the FilterHit Extension method, I get all the color facet results as I want, but now the size Facet results does not reflect the AND behaviour.
=== Color === === Size===
[ ] Blue (40) [ ] Large (70)
[X] Red (50) [ ] Medium (100)
[ ] Green (60) [ ] Small (50)
[ ] Yellow (70)


What I'm after is that i want the color constraint to only apply to the other facets. So Ideally the user can Select Red => Green > Small, and then the facet result should update as follows:

=== Color === === Size===
[ ] Blue (40) [ ] Large (15)
[X] Red (50) [ ] Medium (20)
[ ] Green (60) [ ] Small (15)
[ ] Yellow (70)

=== Color === === Size===
[ ] Blue (40) [ ] Large (35)
[X] Red (50) [ ] Medium (40)
[X] Green (60) [ ] Small (35)
[ ] Yellow (70)

=== Color === === Size===
[ ] Blue (0) [ ] Large (35)
[X] Red (15) [ ] Medium (40)
[X] Green (20) [X] Small (35)
[ ] Yellow (0)
#223686
Edited, Jun 02, 2020 13:19
Vote:
 

I think you can achive this if you use Filter for Color and FilterHit for Size. Ref documentation:

Use the Filter method in most cases, as it filters both the search result and the facets. Use FilterHits when you want to apply a filter to search results (the hits), but not to the facets.

#224057
Jun 10, 2020 9:00
Vote:
 

Did you ever find a good solution for this? I have the same problem and I feel like this should be easier than it seems to be.

#277472
Mar 30, 2022 17:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.