lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Barry <>
Subject SearcherManager vs. MultiReader
Date Wed, 05 Jun 2013 18:12:58 GMT
Hi folks,

I'm looking for some advice on the following scenario:

We have a large static index.  Our application currently copies the
index wholesale and writes new docs to it, but the existing docs are
never deleted or changed.  Our application is multithreaded, it uses
near-real-time search, and it uses SearcherManager.

We'd like to avoid the copy by keeping two indexes, a read-only index
and a writeable index.  Our queries should hit both.

I found MultiReader, and it works great in isolation.  But we'd like
to use it with SearcherManager, but there's a problem:

  SearcherManager manager = new SearcherManager(writer, true, new
SearcherFactory() {
      public IndexSearcher newSearcher(IndexReader r) throws IOException {
          IndexReader multiReader = new MultiReader(r, readOnlyReader);
          IndexSearcher searcher = new IndexSearcher(multiReader);
          return searcher;

Exception in thread "main" java.lang.IllegalStateException:SearcherFactory
must wrap exactly the provided reader (got
MultiReader(StandardDirectoryReader(segments_5:18:nrt _5(4.3):C1)
StandardDirectoryReader(segments_3:1221 _70(
_g8( _99( _el(
_dh( _e1( _ds(
_eb( _f5( _fz(
_gk( _gu( _gf(
_gg( _gh( _gi( _gs(
_gt( _gv( _gw(
_gx( but expected StandardDirectoryReader(segments_5:18:nrt
at com.basistech.gcoref.utils.JBTest.main(

Is it possible to use a SearcherManager with a MultiReader?  If not,
any advice on alternatives for this scenario?

- Joel

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