lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r722964 - in /lucene/java/branches/lucene_2_4/src: java/org/apache/lucene/index/SegmentReader.java test/org/apache/lucene/index/TestIndexReader.java
Date Wed, 03 Dec 2008 16:45:59 GMT
Author: mikemccand
Date: Wed Dec  3 08:45:59 2008
New Revision: 722964

URL: http://svn.apache.org/viewvc?rev=722964&view=rev
Log:
LUCENE-1474 (on 2.4 branch): clear pendingDelCount after flushing deletes

Modified:
    lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/index/TestIndexReader.java

Modified: lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/index/SegmentReader.java?rev=722964&r1=722963&r2=722964&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/index/SegmentReader.java Wed
Dec  3 08:45:59 2008
@@ -591,6 +591,7 @@
       deletedDocs.write(directory(), si.getDelFileName());
       
       si.setDelCount(si.getDelCount()+pendingDeleteCount);
+      pendingDeleteCount = 0;
     }
     if (undeleteAll && si.hasDeletions()) {
       si.clearDelGen();

Modified: lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/index/TestIndexReader.java?rev=722964&r1=722963&r2=722964&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/index/TestIndexReader.java
(original)
+++ lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/index/TestIndexReader.java
Wed Dec  3 08:45:59 2008
@@ -1480,4 +1480,27 @@
 
       r3.close();
     }
+
+  // LUCENE-1474
+  public void testIndexReader() throws Exception {
+    Directory dir = new RAMDirectory();
+    IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(),
+                                         IndexWriter.MaxFieldLength.UNLIMITED);
+    writer.addDocument(createDocument("a"));
+    writer.addDocument(createDocument("b"));
+    writer.addDocument(createDocument("c"));
+    writer.close();
+    IndexReader reader = IndexReader.open(dir);
+    reader.deleteDocuments(new Term("id", "a"));
+    reader.flush();
+    reader.deleteDocuments(new Term("id", "b"));
+    reader.close();
+    IndexReader.open(dir).close();
+  }
+
+  private Document createDocument(String id) {
+    Document doc = new Document();
+    doc.add(new Field("id", id, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
+    return doc;
+  }
 }



Mime
View raw message