Cannot create range facet for Price. Range facets can only be created for numerical types and their nullable counterparts as well as dates.

Vote:
 

while calling:

this.client.Search().RangeFacetFor(x => x.Price, priceRanges.ToArray()).GetResult();

im getting:

[NotSupportedException: Cannot create range facet for Price. Range facets can only be created for numerical types and their nullable counterparts as well as dates.]
   EPiServer.Find.TypeSearchExtensions.RangeFacetFor(ITypeSearch`1 search, Expression`1 fieldSelector, Action`1 facetRequestAction) +527

however:

public decimal Price { get; set; }

So is not decimal numeric type?

#89510
Aug 19, 2014 9:38
Vote:
 

apperantly it is not, from reflected EPiServer.Find.TypeSearchExtensions class:

namespace EPiServer.Find
{
  public static class TypeSearchExtensions
  {
    private static HashSet numericFieldTypes = new HashSet()
    {
      typeof (int),
      typeof (int?),
      typeof (double),
      typeof (double?),
      typeof (short),
      typeof (short?),
      typeof (long),
      typeof (long?),
      typeof (float),
      typeof (float?)
    };

..........

Is there some particular reason for decimal not being numeric type in EPiServer's Find viewpoint?

#89512
Aug 19, 2014 9:40
Vote:
 

Decimal wouldn't work, You have to change the type to double, int, float or short
Or by parsing may work
RangeFacetFor(x => (double)x.TestDescimal)

/K

#89567
Edited, Aug 20, 2014 10:18
Vote:
 

That is perfectly clear, question is: why EPiServer decided not to include decimal as numeric type?

#89568
Aug 20, 2014 10:23
* 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.