Apache Lucene open-source search software
Optimize the test index as preparation for LUCENE-1483, because the statistics on visited terms in TrieRangeQuery/-Filter only work correctly for optimized indexes (as the count is reset on each query execution. So the new multisegment-search must have a one-segment index to only execute the query one time)
Uwe Schindler7ef048e01c4f
diff --git a/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeQuery.java b/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeQuery.javaindex 3ff1f26b8a1..ce486f8bf31 100644--- a/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeQuery.java+++ b/contrib/queries/src/java/org/apache/lucene/search/trie/TrieRangeQuery.java@@ -102,6 +102,7 @@ public final class TrieRangeQuery extends ConstantScoreQuery {/*** EXPERT: Return the number of terms visited during the last execution of the query.* This may be used for performance comparisons of different trie variants and their effectiveness.+ * When using this method be sure to query an one-segment index (optimized one) to get correct results.* This method is not thread safe, be sure to only call it when no query is running!* @throws IllegalStateException if query was not yet executed.*/diff --git a/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.java b/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.javaindex e686e6e6ddb..0bdcb3237a3 100644--- a/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.java+++ b/contrib/queries/src/test/org/apache/lucene/search/trie/TestTrieRangeQuery.java@@ -71,8 +71,9 @@ public class TestTrieRangeQuery extends LuceneTestCasewriter.addDocument(doc);}+ writer.optimize();writer.close();- searcher=new IndexSearcher(directory);+ searcher=new IndexSearcher(directory);} catch (Exception e) {throw new Error(e);}