Search code examples
syntaxsolrfacetfaceted-search

Solr multiple facet sint field range


I'm using Solr 1.4 and have defined the following field in schema.xml:

<field name="SALE_PRICE" type="sint" indexed="true" stored="true" />

With this query I get the expected items within the defined range (25000 to 30000).

http://localhost:8983/solr/select/?q=*%3A*&facet=on&facet.field={!ex=SALE_PRICE}SALE_PRICE&fq={!tag=SALE_PRICE}SALE_PRICE:[25000+TO+30000]

With this query I get the expected items within the defined range (85000 to 90000).

http://localhost:8983/solr/select/?q=*%3A*&facet=on&facet.field={!ex=SALE_PRICE}SALE_PRICE&fq={!tag=SALE_PRICE}SALE_PRICE:[85000+TO+90000]

With this query I expect only items within the two ranges, however, I also get items that are not within the two ranges. For instance, I get items with a SALE_PRICE that is 70000 and items with a SALE_PRICE that is 119000.

http://localhost:8983/solr/select/?q=*%3A*&facet=on&facet.field={!ex=SALE_PRICE}SALE_PRICE&fq={!tag=SALE_PRICE}SALE_PRICE:[25000+TO+30000]+OR+[85000+TO+90000]

Why is the last query not working as expected? How should I write the last query to only selecting items within the two defined ranges?


Solution

  • I just tried this on the default schema and it worked:

    http://localhost:8983/solr/select/?q=*%3A*&facet.field={!ex=p1}price&facet=on&fq={!tag=p1}price:[0%20TO%2010]%20OR%20price:[200%20TO%20500]
    

    Note that the second range also has the field qualifier "price:"