lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Barry <jo...@basistech.com>
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() {
      @Override
      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(4.0.0.2):C720058
_g8(4.0.0.2):C1637114 _99(4.0.0.2):c70045 _el(4.0.0.2):c39757
_dh(4.0.0.2):c38976 _e1(4.0.0.2):c37825 _ds(4.0.0.2):c39388
_eb(4.0.0.2):c39408 _f5(4.0.0.2):c69644 _fz(4.0.0.2):c79754
_gk(4.0.0.2):c91827 _gu(4.0.0.2):c87208 _gf(4.0.0.2):c3914
_gg(4.0.0.2):c3818 _gh(4.0.0.2):c3675 _gi(4.0.0.2):c3995 _gs(4.0.0.2):c3846
_gt(4.0.0.2):c3444 _gv(4.0.0.2):c3630 _gw(4.0.0.2):c7830
_gx(4.0.0.2):c7947)) but expected StandardDirectoryReader(segments_5:18:nrt
_5(4.3):C1))
at
org.apache.lucene.search.SearcherManager.getSearcher(SearcherManager.java:157)
at org.apache.lucene.search.SearcherManager.<init>(SearcherManager.java:89)
at com.basistech.gcoref.utils.JBTest.main(JBTest.java:44)

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

Thanks,
- Joel

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