lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Custom sorting - memory leaks
Date Wed, 23 Aug 2006 07:12:33 GMT

: Is it possible to add some kind of SortComparatorSource class / not
: interface in new lucene releases with default behaviour to cache
: ScoreDocComparators?

Anything's possible with a well written patch :)

: > On a related note: have you considered using FunctionQueries (in teh Solr
: > code base) to do your distance calculations? ... it's been discussed on

: To say the truth i can't figure out how to switch from lucene sorting
: capabilities to FunctionQueries. I have altered RequestHandler with
: parsing SolrQueryRequest, building  complex Query, ChainedFilters,
: Sort objects and i do not want to change all that stuff.

If you are currently doing a search and sorting on a custom Sort, then the
scoring of your queries isn't currently being used at all -- so using a
FunctionQuery is pretty easy:
  1) impliment a ValueSource that does what you want (mainly: takes in a
center point, and computes the distance for each doc from that point --
probably using two FieldCacheSource instances)
  2) construct a FunctionQuery from your ValueSource, and use is as the
main "meat" of your search -- all of your existing search criteria (your
query and your filters) can be use as Filters if you want (since their
scoring doesn't matter) or you can put them into a big BooleanQuery with a
low boost on each (ie: 0.001), and a high boost on your FunctionQuery
(ie: 10000).

If you do care about the "relevency" scoring of your current queries, then
picking exactly how the FunctionQuery fits into your existing Query
structure and what the boost values should be gets trickier -- but it
depends on how significant you want the numeric value of the function to
be on the out come.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message