lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravikumar Govindarajan <ravikumar.govindara...@gmail.com>
Subject Re: Single segment merge in lucene possible?
Date Mon, 24 Feb 2014 16:09:23 GMT
Thanks Uwe. Will try your suggestion

--
Ravi


On Sat, Feb 22, 2014 at 4:20 AM, Uwe Schindler <uwe@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: uwe@thetaphi.de
>
>
> > -----Original Message-----
> > From: Michael McCandless [mailto:lucene@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 <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/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: 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message