mirror of https://github.com/apache/lucene.git
LUCENE-5289: IndexWriter.hasUncommittedChanges was returning false when only deletes were buffered
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1533164 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ea81f1add6
commit
f9f0cdd56f
|
@ -144,6 +144,10 @@ Bug Fixes
|
||||||
* LUCENE-5272: OpenBitSet.ensureCapacity did not modify numBits, causing
|
* LUCENE-5272: OpenBitSet.ensureCapacity did not modify numBits, causing
|
||||||
false assertion errors in fastSet. (Shai Erera)
|
false assertion errors in fastSet. (Shai Erera)
|
||||||
|
|
||||||
|
* LUCENE-5289: IndexWriter.hasUncommittedChanges was returning false
|
||||||
|
when there were buffered delete-by-Term. (Shalin Shekhar Mangar,
|
||||||
|
Mike McCandless)
|
||||||
|
|
||||||
API Changes:
|
API Changes:
|
||||||
|
|
||||||
* LUCENE-5222: Add SortField.needsScores(). Previously it was not possible
|
* LUCENE-5222: Add SortField.needsScores(). Previously it was not possible
|
||||||
|
|
|
@ -2882,7 +2882,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit{
|
||||||
|
|
||||||
/** Returns true if there are changes that have not been committed */
|
/** Returns true if there are changes that have not been committed */
|
||||||
public final boolean hasUncommittedChanges() {
|
public final boolean hasUncommittedChanges() {
|
||||||
return changeCount != lastCommitChangeCount;
|
return changeCount != lastCommitChangeCount || docWriter.anyChanges() || bufferedDeletesStream.any();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void commitInternal() throws IOException {
|
private final void commitInternal() throws IOException {
|
||||||
|
|
|
@ -2253,6 +2253,17 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
assertFalse(writer.hasUncommittedChanges());
|
assertFalse(writer.hasUncommittedChanges());
|
||||||
writer.addDocument(doc);
|
writer.addDocument(doc);
|
||||||
assertTrue(writer.hasUncommittedChanges());
|
assertTrue(writer.hasUncommittedChanges());
|
||||||
|
writer.commit();
|
||||||
|
doc = new Document();
|
||||||
|
doc.add(newStringField("id", "xyz", Field.Store.YES));
|
||||||
|
writer.addDocument(doc);
|
||||||
|
assertTrue(writer.hasUncommittedChanges());
|
||||||
|
writer.commit();
|
||||||
|
assertFalse(writer.hasUncommittedChanges());
|
||||||
|
writer.deleteDocuments(new Term("id", "xyz"));
|
||||||
|
assertTrue(writer.hasUncommittedChanges());
|
||||||
|
writer.commit();
|
||||||
|
assertFalse(writer.hasUncommittedChanges());
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random())));
|
writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random())));
|
||||||
|
|
Loading…
Reference in New Issue