lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psyron>
Subject Re: Custom Sorting
Date Wed, 04 Feb 2009 07:53:59 GMT

Thanks Erik, that helped me a lot ...

but still have somthing, i am not sure about:

If i am using a custom sort - like the DistanceComparator example described
in "oh" your book - and i debugged the code and seem to understand that
the the distances-array is created for all indexed documents - not only
for the search result. The compare-function is then called only for the
docs of the search result, right?
My problem is now, that i wonder, if it is not possible to compute only the
distances from the documents of the search result (that should help the
performance, if there are a lot of documents, but the search result is
mostly very small, right?)

Another point:
Of course it also could be interesting to compute all distances for all
documents the first time a new start location is given, in the case, that
you want do a lot of queries from the same location. But this would then
only make sense, if all distances are cached together with the location
I am not sure how things are actually handled in lucene/solr. What and
at which timer things are cached?

To compute distances only for the search result, i could
- store the reader instance in a variable
- for every doc-id called in the compare function the first time, i could
  compute the distance at this moment
- and then compare
Would this work? Or is there a better way to compute the distances
only on the search result?

A lot of questions, i know,

Thanks for the good book,

Erik Hatcher wrote:
>    * QueryComponent - this is where results are generated, it uses a  
> SortSpec from the QParser.
>    * QParser#getSort - creating a custom QParser you'll be able to  
> wire in your own custom sort
> You can write your own QParserPlugin and QParser, and configure it  
> into solrconfig.xml and should be good to go.  Subclassing existing  
> classes, this should only be a handful of lines of code to do.

View this message in context:
Sent from the Solr - User mailing list archive at

View raw message