lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Single segment merge in lucene possible?
Date Fri, 21 Feb 2014 17:31:17 GMT
A custom MergePolicy can also select single-segment merges.

Mike McCandless

http://blog.mikemccandless.com


On Fri, Feb 21, 2014 at 9:53 AM, Uwe Schindler <uwe@thetaphi.de> wrote:
> Hi,
>
> There are two possibilities:
>
> (1) Use IndexWriter.addIndexes(IndexReader) and copy the old index to a new one. This
will merge everything into one segment.
>
> (2) Use IndexUpgrader and override the method that determines if an index segment is
outdated. If you only return true for the segment that needs to be merged to itself, and later
start the upgrade process, it will exactly do what you want.
>
> This is more or less a copypaste of the example in:
> http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/index/UpgradeIndexMergePolicy.html
> You just have to (anonymously) subclass UpgradeIndexMergePolicy and return true from
"protected boolean shouldUpgradeSegment(SegmentCommitInfo si)" only for the segment to be
merged. By default this returns true for segments that are written by older Lucene versions.
>
> Uwe
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>
>> -----Original Message-----
>> From: Ravikumar Govindarajan [mailto:ravikumar.govindarajan@gmail.com]
>> Sent: Friday, February 21, 2014 3:24 PM
>> To: java-user@lucene.apache.org
>> Subject: Single segment merge in lucene possible?
>>
>> Hi,
>>
>> Is it possible to merge a single segment all by itself, may be just accounting
>> for deletes alone?
>>
>> This is needed so as to solve certain data-locality issues we face in a custom
>> implementation of Directory API.
>>
>> --
>> Ravi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message