Try our conversational search powered by Generative AI!

Search and Navigation: RangeFacetFor with collection of numeric values

Vote:
 

Hello everyone.

I am using Commerce 14, I have indexed a List<int> values for my products that come from the associated Variants, and I am creating a search where I would like to use those values to create numeric range facets using the mentioned List<int>. The problem is that when I try to use:

searchQuery = searchQuery.RangeFacetFor(x => x.ListNumericProperties);

I got the error: System.NotSupportedException: Cannot create range facet for ListNumericProperties. Range facets can only be created for numerical types and their nullable counterparts as well as dates.

Does anyone know a workaround for what I am trying to achieve here? I could parse the List<int> to List<string> and use TermsFacetFor() but I will lose the functionality of the RangeFacetFor to get the Count number.

#318966
Edited, Mar 14, 2024 18:15
Vote:
 

I believe RangeFacetFor is for a property of type number, like decimal, not for property of type List of number. 

Range facets (optimizely.com)

#319123
Mar 18, 2024 7:24
* 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.