lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless" <>
Subject Re: can we do partial optimization?
Date Mon, 03 Dec 2007 09:51:25 GMT

The current trunk of Lucene (unreleased 2.3-dev) has a new method on
IndexWriter: optimize(int maxNumSegments).  This method should do what
you want: you tell it how many segments to optimize down to, and it
will try to pick the least cost merges to get the index to that
point.  It's very new (only committed a few days ago), plus the trunk
may have bugs, so tread carefully!

If that doesn't seem to do the right merges for your index, it's also
very simple to create your own MergePolicy.  You can subclass the
default LogByteSizeMergePolicy and override the
"findMergesForOptimize" method.  This feature (separate MergePolicy)
is also only available in 2.3-dev (trunk).


"Nizamul" <> wrote:
> Hello, 
> I am very new to Lucene.I am facing one problem.
>  I have one very large index which is constantly getting update(add and
>  delete) at a regular interval.after which I am optimizing the whole
>  index (otherwise searches will be slow) but optimization takes time.So I
>  was thinking to merge only the segments of lesser size(I guess it will
>  be a good compromise between search time and optimization time) i.e.
>  suppose I have 10 segment 
> 1 of 10,000,000 doc
> 4 of 100,000 doc
> 4 of 10,000 doc 
> and 1 of 5 doc.
> I want to merger 9 segment of lesser size  in to  one(I believe this
> would not take much time and searching will improve a lot).But I don't
> know how to do partial merging.Whether Lucene allow it or not?? or if I
> can extend indexWriter and add a method optimize of my own where I can
> specify which cfs file to chose for optimization?
> Thanks and Regards,
> Nizam

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message