On 17 Nov 2005, at 03:37, Oren Shir wrote:
Does Luke, Lucli, or any of the existing tools enable merging Lucene
indexes?

No, none of those tools do it, but it is all of about 10 lines of code:

public class IndexMergeTool {
  public static void main(String[] args) throws IOException {
    File mergedIndex = new File(args[0]);

IndexWriter writer = new IndexWriter(mergedIndex, new SimpleAnalyzer(), true);

    Directory[] indexes = new Directory[args.length - 1];
    for (int i = 1; i < args.length; i++) {
      indexes[i  - 1] = FSDirectory.getDirectory(args[i], false);
    }

    writer.addIndexes(indexes);

    writer.optimize();
    writer.close();
  }
}

We could add this to contrib/utils or something, possibly.

    Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to