On Sep 17, 2005, at 7:00 PM, James Huang wrote:

I use a custom collector:

[...]

Then, use IndexSearcher.search(qry, collector);

So what happens if you get 10M results from a search?

This seems to work. What I wish for is that sorting is
done by the search engine itself, hoping for a better
performance (and cleaner code).

And it can be done by Lucene itself...

Previously, I have created a DistanceComparatorSource
(similar to that in LIA-ch6); sorting by distance
works but relevance is lost.

Get back to using your DistanceComparatorSource, and couple that with a SortField.FIELD_SCORE, like this:

Sort sort = new Sort(new SortField[] {new SortField("location",
new DistanceComparatorSource(<whatever args you need>)), SortField.FIELD_SCORE});

    Erik


-James

--- Erik Hatcher <[EMAIL PROTECTED]> wrote:



On Sep 17, 2005, at 4:10 PM, James Huang wrote:


Hi,

I can sort the search results by distance now.

But,

the relevance is lost.

I like to have the results sorted by relevance +
distance, i.e., relevance first; for results of
similar relevance, order by distance. How to do

that?

How are you currently sorting?   You can use
multiple sort fields
within a Sort.

     Erik





__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to