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.java index 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.java index 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 LuceneTestCase writer.addDocument(doc); } + writer.optimize(); writer.close(); - searcher=new IndexSearcher(directory); + searcher=new IndexSearcher(directory); } catch (Exception e) { throw new Error(e); }