You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Jason Rutherglen <ja...@gmail.com> on 2009/03/28 01:21:10 UTC

InstantiatedIndex

Hi Karl,

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?

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.

Jason

Re: InstantiatedIndex

Posted by Karl Wettin <ka...@gmail.com>.
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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org