lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "-\" Goople ;" <goooo...@gmail.com>
Subject What is the recomendation for reopening MultiReader in Lucene 4.x
Date Mon, 30 Jun 2014 05:36:48 GMT
Hi,

I'm migrating from Lucene 3.6.1 to 4.3.0.
I used to have indexer for data in each month and wrapped with one
*MultiReader*.
Behind the multireader, I have ScheduledExecutorService thread keep
reopening the sub-readers in certain interval time. And I got one searcher
for the multireader.

IndexSearcher mySearcher = new IndexSearcher(new *MultiReader*(irs));
// irs is an array of non-NRT index readers.

I have been used the following code to reopen the multireader for my
searcher in Lucen3.6 (which is now not valid for 4.x).

*IndexReader newIr =
IndexReader.openIfChanged(mySearcher.getIndexReader());*
if (newIr != null) {
IndexSearcher oldSearcher = mySearcher;
 IndexSearcher newSearcher = new IndexSearcher(newIr);
 mySearcher= newSearcher;
oldSearcher.getIndexReader().decRef();
}

After migration, I have to change from* IndexReader.openIfChanged* to*
DirectoryReader.openIfChanged.*
So I did change it to something like the following code.. but it failed
because MultiReader cannot be casted to DirectoryReader.

DirectoryReader newIr = DirectoryReader.openIfChanged((DirectoryReader)
mySearcher.getIndexReader());

Do you have any suggestion on doing this in the right way?

Thanks in advance. :)
Pannapat C.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message