28 mar 2009 kl. 01.21 skrev Jason Rutherglen:

I'm thinking InstantiatedIndex needs to implement either clone of all the index data or needs to be able to accept a non-optimized reader, or both. I forget what the obstacles are to implementing the non-optimized reader option? Do you think there are advantages or disadvantages when comparing the solutions?

Hi Jason,

I honestly don't remember the reason but it seems to have something to do with deletions.



Realtime search will need to periodically merge InstantiatedIndex's. One option is to clone an existing index, then add a document to it, clone, and so on, freeze it and later merge it with other indexes. The other option that provides the same functionality is to pass the smaller readers into an InstantiatedIndex.

How do you feel about something like this?

public InstantiatedIndex merge(IndexReader[] readers) {
  Directory dir = new RAMDirectory();
  IndexWriter w = new IndexWriter(dir);
  w.addIndexes(readers);
  w.commit();
  w.optimize();
  w.close();
  IndexReader reader = IndexReader.open(dir);
  InstantiatedIndex ii = new InstantiatedIndex(reader);
  reader.close();
  dir.close();
  return ii;
}



     karl

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to