lucene-java-user mailing list archives

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


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( loop
 - I ran DistanceSortingTest.testNearesRestaurantToHome and to my surprise I
had 6 sorts / log lines of output in while( 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:
Sent from the Lucene - Java Users mailing list archive at

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

View raw message