mirror of https://github.com/apache/lucene.git
LUCENE-2858: fix tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene2858@1237368 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b8df3e0398
commit
24129e1fa2
|
@ -51,7 +51,7 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
writer.close();
|
||||
|
||||
Term searchTerm = new Term("content", "aaa");
|
||||
IndexReader reader = IndexReader.open(dir);
|
||||
DirectoryReader reader = IndexReader.open(dir);
|
||||
IndexSearcher searcher = new IndexSearcher(reader);
|
||||
ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
|
||||
assertEquals("first number of hits", 14, hits.length);
|
||||
|
@ -279,7 +279,7 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
writer.forceMerge(1);
|
||||
|
||||
// Open a reader before closing (commiting) the writer:
|
||||
IndexReader reader = IndexReader.open(dir);
|
||||
DirectoryReader reader = IndexReader.open(dir);
|
||||
|
||||
// Reader should see index as multi-seg at this
|
||||
// point:
|
||||
|
@ -339,7 +339,7 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
public void run() {
|
||||
try {
|
||||
final Document doc = new Document();
|
||||
IndexReader r = IndexReader.open(dir);
|
||||
DirectoryReader r = IndexReader.open(dir);
|
||||
Field f = newField("f", "", StringField.TYPE_UNSTORED);
|
||||
doc.add(f);
|
||||
int count = 0;
|
||||
|
@ -350,7 +350,7 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
f.setValue(s);
|
||||
w.addDocument(doc);
|
||||
w.commit();
|
||||
IndexReader r2 = IndexReader.openIfChanged(r);
|
||||
DirectoryReader r2 = DirectoryReader.openIfChanged(r);
|
||||
assertNotNull(r2);
|
||||
assertTrue(r2 != r);
|
||||
r.close();
|
||||
|
@ -390,10 +390,10 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
for (int i = 0; i < 23; i++)
|
||||
TestIndexWriter.addDoc(writer);
|
||||
|
||||
IndexReader reader = IndexReader.open(dir);
|
||||
DirectoryReader reader = IndexReader.open(dir);
|
||||
assertEquals(0, reader.numDocs());
|
||||
writer.commit();
|
||||
IndexReader reader2 = IndexReader.openIfChanged(reader);
|
||||
DirectoryReader reader2 = DirectoryReader.openIfChanged(reader);
|
||||
assertNotNull(reader2);
|
||||
assertEquals(0, reader.numDocs());
|
||||
assertEquals(23, reader2.numDocs());
|
||||
|
@ -501,7 +501,7 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
for (int i = 0; i < 23; i++)
|
||||
TestIndexWriter.addDoc(writer);
|
||||
|
||||
IndexReader reader = IndexReader.open(dir);
|
||||
DirectoryReader reader = IndexReader.open(dir);
|
||||
assertEquals(0, reader.numDocs());
|
||||
|
||||
writer.prepareCommit();
|
||||
|
@ -511,7 +511,7 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
|
||||
writer.commit();
|
||||
|
||||
IndexReader reader3 = IndexReader.openIfChanged(reader);
|
||||
IndexReader reader3 = DirectoryReader.openIfChanged(reader);
|
||||
assertNotNull(reader3);
|
||||
assertEquals(0, reader.numDocs());
|
||||
assertEquals(0, reader2.numDocs());
|
||||
|
@ -558,7 +558,7 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
for (int i = 0; i < 23; i++)
|
||||
TestIndexWriter.addDoc(writer);
|
||||
|
||||
IndexReader reader = IndexReader.open(dir);
|
||||
DirectoryReader reader = IndexReader.open(dir);
|
||||
assertEquals(0, reader.numDocs());
|
||||
|
||||
writer.prepareCommit();
|
||||
|
@ -568,7 +568,7 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
|
||||
writer.rollback();
|
||||
|
||||
IndexReader reader3 = IndexReader.openIfChanged(reader);
|
||||
IndexReader reader3 = DirectoryReader.openIfChanged(reader);
|
||||
assertNull(reader3);
|
||||
assertEquals(0, reader.numDocs());
|
||||
assertEquals(0, reader2.numDocs());
|
||||
|
@ -622,7 +622,7 @@ public class TestIndexWriterCommit extends LuceneTestCase {
|
|||
|
||||
assertEquals(0, DirectoryReader.getCommitUserData(dir).size());
|
||||
|
||||
IndexReader r = IndexReader.open(dir);
|
||||
DirectoryReader r = IndexReader.open(dir);
|
||||
// commit(Map) never called for this index
|
||||
assertEquals(0, r.getCommitUserData().size());
|
||||
r.close();
|
||||
|
|
|
@ -133,7 +133,7 @@ public class TestIndexWriterConfig extends LuceneTestCase {
|
|||
assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS);
|
||||
assertEquals(16.0, IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB, 0.0);
|
||||
assertEquals(false, IndexWriterConfig.DEFAULT_READER_POOLING);
|
||||
assertEquals(IndexReader.DEFAULT_TERMS_INDEX_DIVISOR, IndexWriterConfig.DEFAULT_READER_TERMS_INDEX_DIVISOR);
|
||||
assertEquals(DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR, IndexWriterConfig.DEFAULT_READER_TERMS_INDEX_DIVISOR);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -186,7 +186,7 @@ public class TestIndexWriterForceMerge extends LuceneTestCase {
|
|||
|
||||
if (0 == pass) {
|
||||
writer.close();
|
||||
IndexReader reader = IndexReader.open(dir);
|
||||
DirectoryReader reader = IndexReader.open(dir);
|
||||
assertEquals(1, reader.getSequentialSubReaders().length);
|
||||
reader.close();
|
||||
} else {
|
||||
|
@ -196,7 +196,7 @@ public class TestIndexWriterForceMerge extends LuceneTestCase {
|
|||
writer.addDocument(doc);
|
||||
writer.close();
|
||||
|
||||
IndexReader reader = IndexReader.open(dir);
|
||||
DirectoryReader reader = IndexReader.open(dir);
|
||||
assertTrue(reader.getSequentialSubReaders().length > 1);
|
||||
reader.close();
|
||||
|
||||
|
|
Loading…
Reference in New Issue