: Let me back up.. for a second. I want to create price ranges. I was thinking : that I would do a search with a sort on price and create ranges by getting : the document price every (docCount / #ofpricerangesIwant). Basically create: : < 10, 10 - 60, 60 - 100 etc.. If the initial search wasn't sorted by price : then I would have to do the second search just to figure out the price : ranges. : : This was the only way I could think to do it. Maybe I'm going at this the : wrong way?
that's certianly one way to do it ... it would probably be faster though to use the TermEnum of the price field directly. but bear in mind that getting ranges that look "clean" is probably harder then you realize. i've yet to really see a good appraoch to progomaticaly determining (non-trivial) numeric ranges, personally i think that to have good looking ranges you pretty much have to have them picked by a person and stored in metadata. i had some comments on this in discussion a little while back... http://www.nabble.com/forum/ViewPost.jtp?post=3753053&framed=y : On 10/11/06, Chris Hostetter <[EMAIL PROTECTED]> wrote: : > : > : > : I need to sort a query two ways. Should I do the search one way: : > : s.getDocListAndSet(query, restrictions, sort, req.getStart(), : > : req.getLimit(), flags); : > : then do the same search again with a different sort value or is there a : > : method available to just sort the DocSet (like sortDocSet but it's : > : protected) : > : : > : OR maybe it doesn't matter because caching will handle it anyway? : > : > check this out from the example solrconfig.xml... : > : > <!-- An optimization that attempts to use a filter to satisfy a search. : > If the requested sort does not include score, then the filterCache : > will be checked for a filter matching the query. If found, the : > filter : > will be used as the source of document ids, and then the sort will : > be : > applied to that. --> : > <useFilterForSortedQuery>true</useFilterForSortedQuery> : > : > ...in those conditions, you should be able to just call getDocList (or : > getDocListAndSet) with your various Sort options and the cache will take : > care of everything. : > : > if you *do* want scores to be included in one of the Sorts, then i would : > try doing that search first using getDocListAndSet -- you can ignore the : > DocSet, but the next call to getDocList should leverage the filterCache, : > and the initial getDocListANdSet call hsould be faster then two seperate : > getDocList calls with different sorts... : > : > ...i think. : > : > : > : > : > -Hoss : > : > : -Hoss