mirror of
https://github.com/apache/lucene.git
synced 2025-02-17 23:45:09 +00:00
add tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1441458 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fc98c11fb9
commit
040ca47778
@ -550,4 +550,71 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
|||||||
writer.close();
|
writer.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testTypeChangeAfterCloseAndDeleteAll() throws Exception {
|
||||||
|
Directory dir = newDirectory();
|
||||||
|
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
|
||||||
|
IndexWriter writer = new IndexWriter(dir, conf);
|
||||||
|
Document doc = new Document();
|
||||||
|
doc.add(new NumericDocValuesField("dv", 0L));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
writer.close();
|
||||||
|
|
||||||
|
writer = new IndexWriter(dir, conf);
|
||||||
|
writer.deleteAll();
|
||||||
|
doc = new Document();
|
||||||
|
doc.add(new SortedDocValuesField("dv", new BytesRef("foo")));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
writer.close();
|
||||||
|
dir.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testTypeChangeAfterDeleteAll() throws Exception {
|
||||||
|
Directory dir = newDirectory();
|
||||||
|
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
|
||||||
|
IndexWriter writer = new IndexWriter(dir, conf);
|
||||||
|
Document doc = new Document();
|
||||||
|
doc.add(new NumericDocValuesField("dv", 0L));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
writer.deleteAll();
|
||||||
|
doc = new Document();
|
||||||
|
doc.add(new SortedDocValuesField("dv", new BytesRef("foo")));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
writer.close();
|
||||||
|
dir.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testTypeChangeAfterCommitAndDeleteAll() throws Exception {
|
||||||
|
Directory dir = newDirectory();
|
||||||
|
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
|
||||||
|
IndexWriter writer = new IndexWriter(dir, conf);
|
||||||
|
Document doc = new Document();
|
||||||
|
doc.add(new NumericDocValuesField("dv", 0L));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
writer.commit();
|
||||||
|
writer.deleteAll();
|
||||||
|
doc = new Document();
|
||||||
|
doc.add(new SortedDocValuesField("dv", new BytesRef("foo")));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
writer.close();
|
||||||
|
dir.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testTypeChangeAfterOpenCreate() throws Exception {
|
||||||
|
Directory dir = newDirectory();
|
||||||
|
IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
|
||||||
|
IndexWriter writer = new IndexWriter(dir, conf);
|
||||||
|
Document doc = new Document();
|
||||||
|
doc.add(new NumericDocValuesField("dv", 0L));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
writer.close();
|
||||||
|
conf.setOpenMode(IndexWriterConfig.OpenMode.CREATE);
|
||||||
|
writer = new IndexWriter(dir, conf);
|
||||||
|
writer.deleteAll();
|
||||||
|
doc = new Document();
|
||||||
|
doc.add(new SortedDocValuesField("dv", new BytesRef("foo")));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
writer.close();
|
||||||
|
dir.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user