On Tue, 2007-06-26 at 16:48 -0700, Mike Klaas wrote: > On 26-Jun-07, at 3:01 PM, Martin Grotzke wrote: > > AFAICS I do not have the possibility to specify range queries in my > > application, as I do not have a clue what's the lowest and highest > > price in the search result and what are "good" ranges according > > to the (statistical) distribution of prices in the search result. > > > > So if it would be possible to go over each item in the search result > > I could check the price field and define my ranges for the specific > > query on solr side and return the price ranges as a facet. > > > > Has anybody done s.th. like this before, or is there s.th. that I'm > > missing and why this approach does not make sense at all? > > > > Otherwise, what would be a good starting point to plug in such > > functionality into solr? > > Easy: facet based on fixed ranges (say, every 10 dollars for x < 100, > 100 dollars for x < 1000, etc)., and combine them sensically on the > client-side. Requires no solr-side modification. But then I have to find x (the highest value of the price field?) on solr side and also I have to build the fixed ranges on solr side, right?
Cheers, Martin > > A bit harder: define your own request handler that loops over the > documents after a search and samples the values of (say) the first 20 > docs (or more, but be sure to use the FieldCache if so). Calculate > your range queries, facets (code will be almost identical to the code > in the builtin request handlers), and return the results. > > cheers, > -Mike > -- Martin Grotzke http://www.javakaffee.de/blog/
signature.asc
Description: This is a digitally signed message part