lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dyzc2010" <zhoucheng2...@gmail.com>
Subject Re: Seem contradictive -- indexwriter in handling multiple threads
Date Wed, 11 Jan 2012 18:32:57 GMT
Mike, do you mean if I create a FSDirectory based writer in first place, then the writer should
be used in every thread rather than create a new RAMDirectory based writer in that thread?




What about I do want to use RAMDirectory to speed up the index and search processes?
 
------------------ Original ------------------
From:  "Michael McCandless"<lucene@mikemccandless.com>;
Date:  Thu, Jan 12, 2012 02:11 AM
To:  "java-user"<java-user@lucene.apache.org>; 

Subject:  Re: Seem contradictive -- indexwriter in handling multiple threads

 
You shouldn't have to write first to intermediate RAMDirectorys
anymore.... just share a single IndexWriter instance across all of
your threads.

Mike McCandless

http://blog.mikemccandless.com

On Wed, Jan 11, 2012 at 12:19 PM, Cheng <zhoucheng2008@gmail.com> wrote:
> I have read a lot about IndexWriter and multi-threading over the Internet.
> It seems to me that the normal practice is:
>
> 1) use a same indexwriter instance for multiple threads;
> 2) create an individual RAMDirectory per threads;
> 3) use addIndexes(Directory[]) methods to add to a local drive folder all
> the indexes stored in the ram directories of the threads.
>
> My question are:
>
> a) For 1), the IndexWriter instance must be associated with a lucene
> Directory, right? Let us assume it is built on a FSDirectory, then what is
> the purpose to use this FSDirectory-built indexwriter in 2), where the
> documents are added into a RAMDirectory? That being said, there must be a
> new index writer created upon a RAMDirectory in each thread. If it is the
> case, we should create a RAMDirectory-built writer in each thread, rather
> than use a FSDirectory-built writer cross multiple threads.
>
> b) For 3), the writer presumed to perform the addIndexes(Directory[])
> function seems to be the same one created in 1). Within each thread, the
> index writer needs to close to make new documents visible to the searcher
> of that thread. So, since the writer has been closed in each or more of the
> threads, how can this writer be used outside the thread run functions to
> add all the RAMDirectories?
>
> Am I missing something?
>
> Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message