lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Causse <dcau...@spotter.com>
Subject Re: index reader for multiple indexes
Date Wed, 09 Dec 2009 17:54:42 GMT
On Fri, Oct 02, 2009 at 11:40:09PM -0700, m.harig wrote:
> 
> Thanks Uwe Schindler ,
> 
>       If i use an IndexReader[] to use MultiReader  , will it be thread
> safe? because i've to reopen my IndexReader to check whether my index is
> updated or not . In this case how do i handle it? please suggest me

Hi,

AFAIK readers are cloned when they are used inside MultiReader, so I
guess reopening a single reader outside MultiReader has no effect and
reopen on MultiReader reopen all the readers.

So I think there is no way to reopen one specific reader inside a
MultiReader without a new instance of the MultiReader.

IMHO the easy way is to use MultiReader as a normal reader (with
default constructor MultiReader(IndexReader... readers) ), forget the
original readers and use reopen on the MultiReader. It should be
thread-safe.
You should check the sources for more complicated usage.

> 
> 
> 
> Uwe Schindler wrote:
> > 
> > Use MultiReader which is an IndexReader on top of various
> > Sub-IndexReaders.
> > 
> > -----
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: uwe@thetaphi.de
> > 
> >> -----Original Message-----
> >> From: m.harig [mailto:m.harig@gmail.com]
> >> Sent: Friday, October 02, 2009 6:52 PM
> >> To: java-user@lucene.apache.org
> >> Subject: index reader for multiple indexes
> >> 
> >> 
> >> hello all ,
> >> 
> >>        am merging more than one indexes to search a document , how do i
> >> use
> >> IndexReader here to open multiple indexes? (since IndexReader will open
> >> one
> >> directory at a time) could any1 please suggest me?
> >> 
> >> 
> >> --
> >> View this message in context: http://www.nabble.com/index-reader-for-
> >> multiple-indexes-tp25716741p25716741.html
> >> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> >> 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/index-reader-for-multiple-indexes-tp25716741p25726159.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 

-- 
David Causse
Spotter
http://www.spotter.com/

---------------------------------------------------------------------
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