lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r580643 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/index/TermVectorsWriter.java src/test/org/apache/lucene/index/TestIndexWriter.java
Date Sat, 29 Sep 2007 21:11:57 GMT
Author: mikemccand
Date: Sat Sep 29 14:11:57 2007
New Revision: 580643

URL: http://svn.apache.org/viewvc?rev=580643&view=rev
Log:
LUCENE-1010: fix corruption case, hit during merge, case when docs with and without term-vectors
are mixed

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsWriter.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=580643&r1=580642&r2=580643&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sat Sep 29 14:11:57 2007
@@ -113,6 +113,12 @@
 16. LUCENE-1006: Fixed QueryParser to accept a "" field value (zero
     length quoted string.)  (yonik)
 
+17. LUCENE-1010: Fixed corruption case when document with no term
+    vector fields is added after documents with term vector fields.
+    This case is hit during merge and would cause an EOFException.
+    This bug was introduced with LUCENE-984.  (Andi Vajda via Mike
+    McCandless)
+
 New features
 
  1. LUCENE-906: Elision filter for French.

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsWriter.java?rev=580643&r1=580642&r2=580643&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/TermVectorsWriter.java Sat Sep 29 14:11:57
2007
@@ -155,7 +155,8 @@
         tvd.writeVLong(fieldPointer-lastFieldPointer);
         lastFieldPointer = fieldPointer;
       }
-    }
+    } else
+      tvd.writeVInt(0);
   }
   
   /** Close all streams. */

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=580643&r1=580642&r2=580643&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java Sat Sep 29 14:11:57
2007
@@ -1489,4 +1489,34 @@
     iw.close();
     dir.close();
   }
+
+  // LUCENE-1010
+  public void testNoTermVectorAfterTermVectorMerge() throws IOException {
+    MockRAMDirectory dir = new MockRAMDirectory();
+    IndexWriter iw = new IndexWriter(dir, new StandardAnalyzer(), true);
+    Document document = new Document();
+    document.add(new Field("tvtest", "a b c", Field.Store.NO, Field.Index.TOKENIZED,
+        Field.TermVector.YES));
+    iw.addDocument(document);
+    iw.flush();
+
+    document = new Document();
+    document.add(new Field("tvtest", "x y z", Field.Store.NO, Field.Index.TOKENIZED,
+                           Field.TermVector.NO));
+    iw.addDocument(document);
+    // Make first segment
+    iw.flush();
+
+    iw.optimize();
+
+    document.add(new Field("tvtest", "a b c", Field.Store.NO, Field.Index.TOKENIZED,
+        Field.TermVector.YES));
+    iw.addDocument(document);
+    // Make 2nd segment
+    iw.flush();
+    iw.optimize();
+
+    iw.close();
+    dir.close();
+  }
 }



Mime
View raw message