lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shashi Kant <shashi....@gmail.com>
Subject Re: how can I merge indexes without deleting the original index?
Date Fri, 04 Sep 2009 13:51:17 GMT
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-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message