Thanks Uwe. Will try your suggestion -- Ravi
On Sat, Feb 22, 2014 at 4:20 AM, Uwe Schindler <u...@thetaphi.de> wrote: > Yeah, as mentioned, UpgradeIndexMergePolicy is easiest to customize to do > that: You only have to override shouldUpgradeSegment() and return true for > the segment to be merged, false otherwise. After that call forceMerge(1) to > trigger the merge (1 does mean nothing, its just needed). > > ----- > Uwe Schindler > H.-H.-Meier-Allee 63, D-28213 Bremen > http://www.thetaphi.de > eMail: u...@thetaphi.de > > > > -----Original Message----- > > From: Michael McCandless [mailto:luc...@mikemccandless.com] > > Sent: Friday, February 21, 2014 6:31 PM > > To: Lucene Users > > Subject: Re: Single segment merge in lucene possible? > > > > 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 <u...@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/Upgra > > > deIndexMergePolicy.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: u...@thetaphi.de > > > > > > > > >> -----Original Message----- > > >> From: Ravikumar Govindarajan > > >> [mailto:ravikumar.govindara...@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-unsubscr...@lucene.apache.org > > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >