From a8fd6068edab9b72662c3528f82e646a6c8cd76a Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Fri, 5 Nov 2010 09:44:53 +0000 Subject: [PATCH] LUCENE-2739: Refactor TestIndexWriter, move out term vectors writing tests git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1031496 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/lucene/index/TestIndexWriter.java | 408 ---------------- .../lucene/index/TestTermVectorsWriter.java | 446 ++++++++++++++++++ 2 files changed, 446 insertions(+), 408 deletions(-) create mode 100644 lucene/src/test/org/apache/lucene/index/TestTermVectorsWriter.java diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java index a6ab77fa075..c34399d5aee 100644 --- a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java +++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java @@ -1050,64 +1050,6 @@ public class TestIndexWriter extends LuceneTestCase { dir.close(); } - // LUCENE-1008 - public void testNoTermVectorAfterTermVector() throws IOException { - Directory dir = newDirectory(); - IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig( - TEST_VERSION_CURRENT, new MockAnalyzer())); - Document document = new Document(); - document.add(newField("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED, - Field.TermVector.YES)); - iw.addDocument(document); - document = new Document(); - document.add(newField("tvtest", "x y z", Field.Store.NO, Field.Index.ANALYZED, - Field.TermVector.NO)); - iw.addDocument(document); - // Make first segment - iw.commit(); - - document.add(newField("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED, - Field.TermVector.YES)); - iw.addDocument(document); - // Make 2nd segment - iw.commit(); - - iw.optimize(); - iw.close(); - dir.close(); - } - - // LUCENE-1010 - public void testNoTermVectorAfterTermVectorMerge() throws IOException { - Directory dir = newDirectory(); - IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig( - TEST_VERSION_CURRENT, new MockAnalyzer())); - Document document = new Document(); - document.add(newField("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED, - Field.TermVector.YES)); - iw.addDocument(document); - iw.commit(); - - document = new Document(); - document.add(newField("tvtest", "x y z", Field.Store.NO, Field.Index.ANALYZED, - Field.TermVector.NO)); - iw.addDocument(document); - // Make first segment - iw.commit(); - - iw.optimize(); - - document.add(newField("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED, - Field.TermVector.YES)); - iw.addDocument(document); - // Make 2nd segment - iw.commit(); - iw.optimize(); - - iw.close(); - dir.close(); - } - // LUCENE-1036 public void testMaxThreadPriority() throws IOException { int pri = Thread.currentThread().getPriority(); @@ -1376,139 +1318,6 @@ public class TestIndexWriter extends LuceneTestCase { dir.close(); } - // LUCENE-1168 - public void testTermVectorCorruption() throws IOException { - - Directory dir = newDirectory(); - for(int iter=0;iter<2;iter++) { - IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( - TEST_VERSION_CURRENT, new MockAnalyzer()) - .setMaxBufferedDocs(2).setRAMBufferSizeMB( - IndexWriterConfig.DISABLE_AUTO_FLUSH).setMergeScheduler( - new SerialMergeScheduler()).setMergePolicy( - new LogDocMergePolicy())); - - Document document = new Document(); - - Field storedField = newField("stored", "stored", Field.Store.YES, - Field.Index.NO); - document.add(storedField); - writer.addDocument(document); - writer.addDocument(document); - - document = new Document(); - document.add(storedField); - Field termVectorField = newField("termVector", "termVector", - Field.Store.NO, Field.Index.NOT_ANALYZED, - Field.TermVector.WITH_POSITIONS_OFFSETS); - - document.add(termVectorField); - writer.addDocument(document); - writer.optimize(); - writer.close(); - - IndexReader reader = IndexReader.open(dir, true); - for(int i=0;i