Add protected convenience method for LUCENE-887. It neither changes IndexWriter's behavior, nor is this a public API change.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@543071 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Busch 2007-05-31 07:20:14 +00:00
parent f5c80265e0
commit f86b74623d
1 changed files with 9 additions and 2 deletions

View File

@ -1705,12 +1705,19 @@ public class IndexWriter {
/** Expert: Flushes all RAM-resident segments (buffered documents), then may merge segments. */ /** Expert: Flushes all RAM-resident segments (buffered documents), then may merge segments. */
private final synchronized void flushRamSegments() throws CorruptIndexException, IOException { private final synchronized void flushRamSegments() throws CorruptIndexException, IOException {
flushRamSegments(true);
}
/** Expert: Flushes all RAM-resident segments (buffered documents),
* then may merge segments if triggerMerge==true. */
protected final synchronized void flushRamSegments(boolean triggerMerge)
throws CorruptIndexException, IOException {
if (ramSegmentInfos.size() > 0 || bufferedDeleteTerms.size() > 0) { if (ramSegmentInfos.size() > 0 || bufferedDeleteTerms.size() > 0) {
mergeSegments(ramSegmentInfos, 0, ramSegmentInfos.size()); mergeSegments(ramSegmentInfos, 0, ramSegmentInfos.size());
maybeMergeSegments(minMergeDocs); if (triggerMerge) maybeMergeSegments(minMergeDocs);
} }
} }
/** /**
* Flush all in-memory buffered updates (adds and deletes) * Flush all in-memory buffered updates (adds and deletes)
* to the Directory. * to the Directory.