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 Sebastin <se...@gmail.com> on 2008/06/20 08:04:12 UTC

creating Array of IndexReaders

Hi All,


I need to create dynamic Index Readers based on the user input.

for example

if the user needs to see the records from june 17-june 20 


        Directory indexFsDir1 =
FSDirectory.getDirectory("C:\\200806\\17\\outgoing1", false);
        IndexReader indexIR1 = IndexReader.open(indexFsDir1);

Directory indexFsDir1 =
FSDirectory.getDirectory("C:\\200806\\18\\outgoing1", false);
        IndexReader indexIR2 = IndexReader.open(indexFsDir1);

Directory indexFsDir1 =
FSDirectory.getDirectory("C:\\200806\\19\\outgoing1", false);
        IndexReader indexIR3 = IndexReader.open(indexFsDir1);

Directory indexFsDir1 =
FSDirectory.getDirectory("C:\\200806\\20\\outgoing1", false);
        IndexReader indexIR4 = IndexReader.open(indexFsDir1);


        IndexReader[] readArray = 
        { indexIR1, indexIR2, indexIR3, indexIR4};
          
   

        //merged reader
        IndexReader mergedReader = new MultiReader(readArray);
        
        IndexSearcher is = new IndexSearcher(mergedReader);

likewise is there any possibility to create Array of Index Readers.


-- 
View this message in context: http://www.nabble.com/creating-Array-of-IndexReaders-tp18023594p18023594.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: creating Array of IndexReaders

Posted by Sebastin <se...@gmail.com>.
Hi otis,

Rightnow I am using Multi Reader by just collecting array of indexReaders

IndexReader[] readArray = 
        { indexIR1, indexIR2, indexIR3, indexIR4};
           
   
 
         //merged reader
         IndexReader mergedReader = new MultiReader(readArray);

its not possible for me to create array of index readers based on the user
input? IndexReader 


Otis Gospodnetic wrote:
> 
> Hi,
> 
> Have you looked at MultiReader?  Opening IndexReaders like that will cost
> you...
> 
> 
> Otis
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
> 
> 
> ----- Original Message ----
>> From: Sebastin <se...@gmail.com>
>> To: java-user@lucene.apache.org
>> Sent: Friday, June 20, 2008 2:04:12 AM
>> Subject: creating Array of IndexReaders
>> 
>> 
>> Hi All,
>> 
>> 
>> I need to create dynamic Index Readers based on the user input.
>> 
>> for example
>> 
>> if the user needs to see the records from june 17-june 20 
>> 
>> 
>>         Directory indexFsDir1 =
>> FSDirectory.getDirectory("C:\\200806\\17\\outgoing1", false);
>>         IndexReader indexIR1 = IndexReader.open(indexFsDir1);
>> 
>> Directory indexFsDir1 =
>> FSDirectory.getDirectory("C:\\200806\\18\\outgoing1", false);
>>         IndexReader indexIR2 = IndexReader.open(indexFsDir1);
>> 
>> Directory indexFsDir1 =
>> FSDirectory.getDirectory("C:\\200806\\19\\outgoing1", false);
>>         IndexReader indexIR3 = IndexReader.open(indexFsDir1);
>> 
>> Directory indexFsDir1 =
>> FSDirectory.getDirectory("C:\\200806\\20\\outgoing1", false);
>>         IndexReader indexIR4 = IndexReader.open(indexFsDir1);
>> 
>> 
>>         IndexReader[] readArray = 
>>         { indexIR1, indexIR2, indexIR3, indexIR4};
>>           
>>   
>> 
>>         //merged reader
>>         IndexReader mergedReader = new MultiReader(readArray);
>>         
>>         IndexSearcher is = new IndexSearcher(mergedReader);
>> 
>> likewise is there any possibility to create Array of Index Readers.
>> 
>> 
>> -- 
>> View this message in context: 
>> http://www.nabble.com/creating-Array-of-IndexReaders-tp18023594p18023594.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/creating-Array-of-IndexReaders-tp18023594p18023991.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: creating Array of IndexReaders

Posted by saikrishna venkata pendyala <pv...@gmail.com>.
Hi Sebastin ,

Why dont you index all data into single or some fixed number of indexes and
search over them. You can always restrict your search using the range query
based on user given inputs.

--Sai Krishna.

On Mon, Jun 23, 2008 at 7:27 AM, Daniel Noll <da...@nuix.com> wrote:

> On Saturday 21 June 2008 18:57:49 Sebastin wrote:
> > Since i am maintaining more than 1.5 years records in the windows 2003
> > server,based on the user input for example if the user wants to display
> > june 1 - june 15 folders and fetch the records from them.if the user
> wants
> > to display may 1-may15 records i need to open those folders.thatswhy i am
> > opening the index readers based on the user input.is it possible to
> create
> > the array of index raders based on user input.
>
> Is that not what your original code was already doing?  If not, some small
> modification must be all you really need.
>
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: creating Array of IndexReaders

Posted by Daniel Noll <da...@nuix.com>.
On Saturday 21 June 2008 18:57:49 Sebastin wrote:
> Since i am maintaining more than 1.5 years records in the windows 2003
> server,based on the user input for example if the user wants to display
> june 1 - june 15 folders and fetch the records from them.if the user wants
> to display may 1-may15 records i need to open those folders.thatswhy i am
> opening the index readers based on the user input.is it possible to create
> the array of index raders based on user input.

Is that not what your original code was already doing?  If not, some small 
modification must be all you really need.

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: creating Array of IndexReaders

Posted by Sebastin <se...@gmail.com>.
Hi otis,

Since i am maintaining more than 1.5 years records in the windows 2003
server,based on the user input for example if the user wants to display june
1 - june 15 folders and fetch the records from them.if the user wants to
display may 1-may15 records i need to open those folders.thatswhy i am
opening the index readers based on the user input.is it possible to create
the array of index raders based on user input.


Otis Gospodnetic wrote:
> 
> Hi,
> 
> I think you mentioned 225GB of data somewhere.
> You can open IndexReaders "on demand", but that's not a cheap operation,
> esp. not with so much data.  You want to keep your IndexReaders opened for
> a while.  Multiple requests/threads can share them.
> 
> Otis
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
> 
> 
> ----- Original Message ----
>> From: Sebastin <se...@gmail.com>
>> To: java-user@lucene.apache.org
>> Sent: Friday, June 20, 2008 2:46:32 AM
>> Subject: Re: creating Array of IndexReaders
>> 
>> 
>> Hi otis,
>> 
>> Rightnow I am using Multi Reader by just collecting array of indexReaders
>> 
>> IndexReader[] readArray = 
>>         { indexIR1, indexIR2, indexIR3, indexIR4};
>>           
>>   
>> 
>>          //merged reader
>>          IndexReader mergedReader = new MultiReader(readArray);
>> 
>> its not possible for me to create array of index readers based on the
>> user
>> input? IndexReader 
>> 
>> 
>> Otis Gospodnetic wrote:
>> > 
>> > Hi,
>> > 
>> > Have you looked at MultiReader?  Opening IndexReaders like that will
>> cost
>> > you...
>> > 
>> > 
>> > Otis
>> > --
>> > Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>> > 
>> > 
>> > ----- Original Message ----
>> >> From: Sebastin 
>> >> To: java-user@lucene.apache.org
>> >> Sent: Friday, June 20, 2008 2:04:12 AM
>> >> Subject: creating Array of IndexReaders
>> >> 
>> >> 
>> >> Hi All,
>> >> 
>> >> 
>> >> I need to create dynamic Index Readers based on the user input.
>> >> 
>> >> for example
>> >> 
>> >> if the user needs to see the records from june 17-june 20 
>> >> 
>> >> 
>> >>         Directory indexFsDir1 =
>> >> FSDirectory.getDirectory("C:\\200806\\17\\outgoing1", false);
>> >>         IndexReader indexIR1 = IndexReader.open(indexFsDir1);
>> >> 
>> >> Directory indexFsDir1 =
>> >> FSDirectory.getDirectory("C:\\200806\\18\\outgoing1", false);
>> >>         IndexReader indexIR2 = IndexReader.open(indexFsDir1);
>> >> 
>> >> Directory indexFsDir1 =
>> >> FSDirectory.getDirectory("C:\\200806\\19\\outgoing1", false);
>> >>         IndexReader indexIR3 = IndexReader.open(indexFsDir1);
>> >> 
>> >> Directory indexFsDir1 =
>> >> FSDirectory.getDirectory("C:\\200806\\20\\outgoing1", false);
>> >>         IndexReader indexIR4 = IndexReader.open(indexFsDir1);
>> >> 
>> >> 
>> >>         IndexReader[] readArray = 
>> >>         { indexIR1, indexIR2, indexIR3, indexIR4};
>> >>          
>> >>  
>> >> 
>> >>         //merged reader
>> >>         IndexReader mergedReader = new MultiReader(readArray);
>> >>        
>> >>         IndexSearcher is = new IndexSearcher(mergedReader);
>> >> 
>> >> likewise is there any possibility to create Array of Index Readers.
>> >> 
>> >> 
>> >> -- 
>> >> View this message in context: 
>> >>
>> http://www.nabble.com/creating-Array-of-IndexReaders-tp18023594p18023594.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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/creating-Array-of-IndexReaders-tp18023594p18042275.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