addIndexes(Dir[]) was the only user of mergeSegments() that passed an
endpoint that wasn't the end of the segment list, and hence the only
caller to mergeSegments() that will see a change of behavior.

Given that, I feel comfortable enough to commit this.

-Yonik
http://incubator.apache.org/solr Solr, The Open Source Lucene Search Server

On 4/5/06, Yonik Seeley <[EMAIL PROTECTED]> wrote:
> OK, the following patch seems to work for me!
> You might want to try it out on your larger test Dan.
>
> The first part probably isn't necessary (the base=start instead of
> start+1), but the second part is.
>
> -Yonik
> http://incubator.apache.org/solr Solr, The Open Source Lucene Search Server
>
>
>
> Index: org/apache/lucene/index/IndexWriter.java
> ===================================================================
> --- org/apache/lucene/index/IndexWriter.java    (revision 391084)
> +++ org/apache/lucene/index/IndexWriter.java    (working copy)
> @@ -569,7 +569,7 @@
>
>      // merge newly added segments in log(n) passes
>      while (segmentInfos.size() > start+mergeFactor) {
> -      for (int base = start+1; base < segmentInfos.size(); base++) {
> +      for (int base = start; base < segmentInfos.size(); base++) {
>          int end = Math.min(segmentInfos.size(), base+mergeFactor);
>          if (end-base > 1)
>            mergeSegments(base, end);
> @@ -710,9 +710,9 @@
>        infoStream.println(" into "+mergedName+" ("+mergedDocCount+" docs)");
>      }
>
> -    for (int i = end-1; i >= minSegment; i--)     // remove old infos & add 
> new
>
> +    for (int i = end-1; i > minSegment; i--)     // remove old infos & add 
> new
>        segmentInfos.remove(i);
> -    segmentInfos.addElement(new SegmentInfo(mergedName, mergedDocCount,
> +    segmentInfos.set(minSegment, new SegmentInfo(mergedName, mergedDocCount,
>                                              directory));
>
>      // close readers before we attempt to delete now-obsolete segments
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to