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

Rangefacetsfor doesnot work with decimal

Vote:
 

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

 {

[Display(

  Name = "RRP",

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

public virtual int TestInt { get; set; }

[Display(

  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())

                         .GetContentResult();

 

var productContents2 = SearchClient.Instance.Search()

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

                        .GetContentResult(); 

---------------------------------------------

#88643
Jul 22, 2014 13:28
Vote:
 

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)
#89279
Aug 12, 2014 15:14
Vote:
 

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

#89319
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.