lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From javaguy44 <javagu...@yahoo.com>
Subject Lucene SORT does a sort on entire index..how do I filter SORT?
Date Fri, 21 Aug 2009 14:00:37 GMT

Hi,

I'm currently looking at sorting in lucene, and to get started I took a look
at the distance sorting example from the Lucene in Action book.

Working through the test DistanceSortingTest, I've noticed that performing
the SORT ends up sorting the whole index!

To test this I did the following:
 - added a few more lines in setup()
    addPoint(writer, "Nico's Fish Shop", "fishmongerie", 10, 10);
    addPoint(writer, "Nico's Fish Shop deux", "fishmongerie", 10, 10);

 - I added a log statement to DistanceComparatorSource in the
while(termDocs.next()) loop
 - I ran DistanceSortingTest.testNearesRestaurantToHome and to my surprise I
had 6 sorts / log lines of output in while(termDocs.next()) loop

DistanceSortingTest.testNearesRestaurantToHome searches by the query term
new TermQuery(new Term("type", "restaurant")).  As such shouldn't the index
be filtered first (to 4 documents) before the DistanceSort occurs?

Obviously this is not ideal in a million+ document index and assuming you
had 100, 200 records that were hit based on the term.

Would appreciate someone's input / advice on how to filter first
-- 
View this message in context: http://www.nabble.com/Lucene-SORT-does-a-sort-on-entire-index..how-do-I-filter-SORT--tp25080365p25080365.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message