mirror of https://github.com/apache/lucene.git
LUCENE-3529: add test for trunk
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1188284 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8602dd54fd
commit
15f471a737
|
@ -887,6 +887,28 @@ public class TestIndexWriter extends LuceneTestCase {
|
|||
reader.close();
|
||||
dir.close();
|
||||
}
|
||||
|
||||
public void testEmptyFieldNameWithEmptyTerm() throws IOException {
|
||||
Directory dir = newDirectory();
|
||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
|
||||
Document doc = new Document();
|
||||
doc.add(newField("", "", StringField.TYPE_UNSTORED));
|
||||
doc.add(newField("", "a", StringField.TYPE_UNSTORED));
|
||||
doc.add(newField("", "b", StringField.TYPE_UNSTORED));
|
||||
doc.add(newField("", "c", StringField.TYPE_UNSTORED));
|
||||
writer.addDocument(doc);
|
||||
writer.close();
|
||||
IndexReader reader = IndexReader.open(dir, true);
|
||||
IndexReader subreader = getOnlySegmentReader(reader);
|
||||
TermsEnum te = subreader.fields().terms("").iterator();
|
||||
assertEquals(new BytesRef(""), te.next());
|
||||
assertEquals(new BytesRef("a"), te.next());
|
||||
assertEquals(new BytesRef("b"), te.next());
|
||||
assertEquals(new BytesRef("c"), te.next());
|
||||
assertNull(te.next());
|
||||
reader.close();
|
||||
dir.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue