djangodjango-haystackxapian

haystack xapian numeric range


Trying to setup a price range with haystack and xapian. We had it working with solr by passing in a query like this via HTTP GET.

To get a price from 2 to 3 dollars:

selected_facets=price:[2+TO+3]

But using the xapian backend, it returns nothing. I am getting a list of facets so i know the database is present and working. Doing an exact query works too, just the ranges that don't work.


Solution

  • Xapian syntax for range queries is:

    field:range_from..range_to
    

    In your case it would be something like

    selected_facets=price:2..3
    

    See: http://xapian.org/docs/valueranges.html