Fixed a bug where adding an optimized index to an empty index failed.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149614 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doug Cutting 2001-10-20 02:32:59 +00:00
parent 1c31f33cce
commit b91b113e86
1 changed files with 2 additions and 1 deletions

View File

@ -206,7 +206,8 @@ public final class IndexWriter {
flushRamSegments();
while (segmentInfos.size() > 1 ||
(segmentInfos.size() == 1 &&
SegmentReader.hasDeletions(segmentInfos.info(0)))){
(SegmentReader.hasDeletions(segmentInfos.info(0)) ||
segmentInfos.info(0).dir != directory))) {
int minSegment = segmentInfos.size() - mergeFactor;
mergeSegments(minSegment < 0 ? 0 : minSegment);
}