priceRanges Widget Issue

I’m attempting to use the “priceRanges” widget, but I’m running into the problem of when I select a range it always states “no results”. What is odd is that the ranges that are in the widget are correct. Reading the documents I noticed that it states in the Requirements that the data for “attributeName” must be a JavaScript number. I know for a fact that the data that is coming in is a string. At this moment I don’t know well enough how I’m suppose to take an “attributeNames” data that is a string and convert it to a JavaScript number.

This problem also is happening when I try to use “rangeSlider”

Right now what I have is not that much different than the example:

search.addWidget(
  instantsearch.widgets.priceRanges({
    container: '#priceRange',
    attributeName: 'price',
    labels: {
      currency: '$',
      separator: 'to',
      button: 'Go'
    },
    templates: {
      header: 'Price'
    },
  })
);

Figured out through the backend. This issue can be closed.

Hi @westcap-marine,

I’m experiencing the same issue with any of the range widgets I’ve tried using, priceRanges, rangeInput and rangeSlider. None of the range widgets are working for me and giving the same “no results” output. You mentioned it was something in the back-end? Let me know if you can share the fix that worked for you.

Thank You!

-Derek Jesser

Figured out the solution as well now. The data in the back-end for the fields I wanted to use ranges on were set as strings rather then numbers. Updated them to be numbers and the ranges work great now.