Apache Lucene open-source search software
LUCENE-2142: merge 3.x test only, as trunk uses different StringIndex variant
Uwe Schindler18d21f9f1160
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex ca458187d56..cb7cfa9c34c 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -389,6 +389,10 @@ Bug fixesa prior (corrupt) index missing its segments_N file. (MikeMcCandless)+* LUCENE-2142 (correct fix): FieldCacheImpl.getStringIndex no longer+ throws an exception when term count exceeds doc count.+ (Mike McCandless, Uwe Schindler)+New features* LUCENE-2128: Parallelized fetching document frequencies during weightdiff --git a/lucene/src/test/org/apache/lucene/search/TestSort.java b/lucene/src/test/org/apache/lucene/search/TestSort.javaindex e664c8832c7..3e3ae7257ae 100644--- a/lucene/src/test/org/apache/lucene/search/TestSort.java+++ b/lucene/src/test/org/apache/lucene/search/TestSort.java@@ -1039,4 +1039,23 @@ public class TestSort extends LuceneTestCase implements Serializable {dir.close();}+ public void testLUCENE2142() throws IOException {+ RAMDirectory indexStore = new RAMDirectory ();+ IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(+ TEST_VERSION_CURRENT, new MockAnalyzer()));+ for (int i=0; i<5; i++) {+ Document doc = new Document();+ doc.add (new Field ("string", "a"+i, Field.Store.NO, Field.Index.NOT_ANALYZED));+ doc.add (new Field ("string", "b"+i, Field.Store.NO, Field.Index.NOT_ANALYZED));+ writer.addDocument (doc);+ }+ writer.optimize(); // enforce one segment to have a higher unique term count in all cases+ writer.close();+ sort.setSort(+ new SortField("string", SortField.STRING),+ SortField.FIELD_DOC );+ // this should not throw AIOOBE or RuntimeEx+ new IndexSearcher (indexStore, true).search(new MatchAllDocsQuery(), null, 500, sort);+ }+}