From b91b113e861457fc38029306fc2f39e3a04d0c17 Mon Sep 17 00:00:00 2001 From: Doug Cutting Date: Sat, 20 Oct 2001 02:32:59 +0000 Subject: [PATCH] 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 --- src/java/org/apache/lucene/index/IndexWriter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/lucene/index/IndexWriter.java b/src/java/org/apache/lucene/index/IndexWriter.java index fa1335c12cf..41e2a6d3bd1 100644 --- a/src/java/org/apache/lucene/index/IndexWriter.java +++ b/src/java/org/apache/lucene/index/IndexWriter.java @@ -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); }