lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francisco Borges <francisco.bor...@gmail.com>
Subject Re: how can I merge indexes without deleting the original index?
Date Fri, 04 Sep 2009 15:50:28 GMT
Hello,

Many thanks for the sample. I've already written a proof of concept with it.

Cheers,
Francisco

On Sep 4, 2009 3:53 PM, "Shashi Kant" <shashi.mit@gmail.com> wrote:

Here is some code to help you along.  This should leave the source
indices intact and merges them into a destination.

               //the index to hold our merged index
               IndexWriter iw = new IndexWriter(dest, new
StandardAnalyzer(), true);

               string[] sourceIndices; //an array containing the sources
              // the directory containing the "source" indices
               foreach (string si in sourceindices)
               {
                   IndexReader r = IndexReader.Open(si);
                   iw.AddIndexes(new IndexReader[] { r });
                   r.Close();
               }

               iw.Optimize();
               iw.Close();

--------------------------------------------------------------------- To
unsubscribe, e-mail: java-...

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