You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "m.harig" <m....@gmail.com> on 2009/10/02 18:52:30 UTC

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


Re: index reader for multiple indexes

Posted by David Causse <dc...@spotter.com>.
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


RE: index reader for multiple indexes

Posted by "m.harig" <m....@gmail.com>.
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



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


RE: index reader for multiple indexes

Posted by Uwe Schindler <uw...@thetaphi.de>.
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