LUCENE-2142: merge 3.x test only, as trunk uses different StringIndex variant

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@957492 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2010-06-24 10:24:15 +00:00
parent f81a5d9bf6
commit 18d21f9f11
2 changed files with 23 additions and 0 deletions

View File

@ -389,6 +389,10 @@ Bug fixes
a prior (corrupt) index missing its segments_N file. (Mike
McCandless)
* 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 weight

View File

@ -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);
}
}