Try our conversational search powered by Generative AI!

Rangefacetsfor doesnot work with decimal


RangeFacetFor gives this error for any field defined as Decimal but works fine with Int and doubles. I am wondering is there any way to work with the decimals. Is it a bug?

We get following error "Cannot create range facet for TestDecimal. Range facets can only be created for numerical types and their nullable counterparts as well as dates."

public class BookProduct : ProductContent



  Name = "RRP",

  Description = "The RRP for the book.")]

public virtual int TestInt { get; set; }


  Name = "RRP",

  Description = "The RRP for the book.")]

public virtual decimal TestDecimal { get; set; }



var productContents3 = SearchClient.Instance.Search()

                         .RangeFacetFor(x => x.TestInt, priceRanges.ToArray())



var productContents2 = SearchClient.Instance.Search()

                         .RangeFacetFor(x => x.TestDecimal, priceRanges.ToArray())



Jul 22, 2014 13:28

Looks like the supported types are int, double, short, long and float.  Maybe you could parse it if that is possible

.RangeFacetFor(x => (double)x.TestDescimal)
Aug 12, 2014 15:14

Thanks for your input. We were on early stage of project, we changed type from decimal to double.

Aug 13, 2014 12:02
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.