On 2/19/2010 2:15 AM, Kelly Taylor wrote:
All sorting of facets works great at the field level (count/index)...all good
there...but how is sorting accomplished with range queries? The solrj
response doesn't seem to maintain the order the queries are sent in, and the
order is not in index or count order. What's the trick?

http://localhost:8983/solr/select?q=someterm
   &rows=0
   &facet=true
   &facet.limit=-1
   &facet.query=price:[* TO 100]
   &facet.query=price:[100 TO 200]
   &facet.query=price:[200 TO 300]
   &facet.query=price:[300 TO 400]
   &facet.query=price:[400 TO 500]
   &facet.query=price:[500 TO 600]
   &facet.query=price:[600 TO 700]
   &facet.query=price:[700 TO *]
   &facet.mincount=1
   &collapse.field=dedupe_hash
   &collapse.threshold=1
   &collapse.type=normal
   &collapse.facet=before

The "trick" I use is to use LocalParams to give eacht facet query a well defined name. Afterwards you can loop through the names in whatever order you want.
so basically facet.query={!key=price_0}[* TO 100] etc.

N.B. the facet queries in your example will lead to some documents to be counted double (i.e. when the price is exactly 100, 200, 300).

Regards,

gwk

Reply via email to