lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r355181 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/index/MultiReader.java src/test/org/apache/lucene/index/TestMultiReader.java
Date Thu, 08 Dec 2005 19:53:08 GMT
Author: cutting
Date: Thu Dec  8 11:53:06 2005
New Revision: 355181

URL: http://svn.apache.org/viewcvs?rev=355181&view=rev
Log:
Fix LUCENE-479: After MultiReader.undeleteAll(), numDocs was incorrect.  Contributed by Robert
Kirchgessner.

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiReader.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/CHANGES.txt?rev=355181&r1=355180&r2=355181&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Thu Dec  8 11:53:06 2005
@@ -319,6 +319,9 @@
 19. Corrected term offsets returned by ChineseTokenizer.
     (Ray Tsang via Erik Hatcher, LUCENE-324)
 
+20. Fixed MultiReader.undeleteAll() to correctly update numDocs.
+    (Robert Kirchgessner via Doug Cutting, LUCENE-479)
+
 Optimizations
      
  1. Disk usage (peak requirements during indexing and optimization)

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java?rev=355181&r1=355180&r2=355181&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/MultiReader.java Thu Dec  8 11:53:06
2005
@@ -122,6 +122,7 @@
     for (int i = 0; i < subReaders.length; i++)
       subReaders[i].undeleteAll();
     hasDeletions = false;
+    numDocs = -1;                                 // invalidate cache
   }
 
   private int readerIndex(int n) {    // find reader for doc n:

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiReader.java?rev=355181&r1=355180&r2=355181&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiReader.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestMultiReader.java Thu Dec  8 11:53:06
2005
@@ -69,6 +69,18 @@
     assertTrue(vector != null);
     TestSegmentReader.checkNorms(reader);
   }
+
+  public void testUndeleteAll() throws IOException {
+    sis.read(dir);
+    MultiReader reader = new MultiReader(dir, sis, false, readers);
+    assertTrue(reader != null);
+    assertEquals( 2, reader.numDocs() );
+    reader.delete(0);
+    assertEquals( 1, reader.numDocs() );
+    reader.undeleteAll();
+    assertEquals( 2, reader.numDocs() );
+  }
+        
   
   public void testTermVectors() {
     MultiReader reader = new MultiReader(dir, sis, false, readers);



Mime
View raw message