Is the machinery in place to do this now (hook up a function query to be used in sorting)?
I'm trying to figure out what's the best way to do a distance sort: custom comparator or function query. Using a custom comparator seems straightforward and reusable across both the standard and dismax handlers. But it also seems most likely to impact performance (or at least require the most work/knowledge to get right by minimizing calculations, caching, watching out for memory leaks, etc.). (Speaking of which, could anyone with more Lucene/Solr experience than I comment on the performance characteristics of the locallucene implementation mentioned on the list recently? I've taken a first look and it seems reasonable to me.) Using a function query, as Yonik suggests above, is another approach. But to get a true sort, you have to boost the original query to zero? How does this impact the results returned by the original query? Will the requirements (and boosts) of the original (now nested) query remain intact, only sorted by the function? Also, is there any way to do this with the dismax handler? Thanks, - Jon On 9/27/07, Yonik Seeley <[EMAIL PROTECTED]> wrote: > On 9/27/07, Erik Hatcher <[EMAIL PROTECTED]> wrote: > > Using something like this, how would the custom SortComparatorSource > > get a parameter from the request to use in sorting calculations? > > perhaps hook in via function query: > dist(10.4,20.2,geoloc) > > And either manipulate the score with that and sort by score, > > q=+(foo bar)^0 dist(10.4,20.2,geoloc) > sort=score asc > > or extend solr's sorting mechanisms to allow specifying a function to sort by. > > sort="dist(10.4,20.2,geoloc) asc" > > -Yonik >