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.