Hi,

a quick alternative is to get the underlying reader from IndexSearcher. You 
just don't use the IndexSearcher provided by SearcherManager, you just use it 
to access the underlying Index-/DirectoryReader, that you can feed into new 
MultiReaders. The good thing with that is:

- Every index has its own searcher manager and can therefor update itsself 
separately
- The search logic, just fetches the IndexSearcher from every searchermanager 
that it is interested in, but instead of using the IndexSearchers directly, 
just ignore them and fetch the underlying IndexReader: 
IndexSearcher#getIndexReader

There is no overhead inbvolved, as IndexSearcher is just a "cheap wrapper" 
around IndexReader. If you don't use it, don't care.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de

> -----Original Message-----
> From: Vladimir Kotal [mailto:vladimir.ko...@oracle.com]
> Sent: Thursday, July 21, 2016 7:34 PM
> To: java-user@lucene.apache.org
> Subject: Re: MmapDirectory and IndexReader reuse
> 
> On 07/18/16 05:52 PM, Uwe Schindler wrote:
> > Hi,
> >
> > Have a separate searcher manager for every directory. On every incoming
> search request, fetch the actual DirectoryReaders from the searcher
> managers and build a MultiReader from it. This costs nothing, as MultiReader
> is just a thin wrapper where no caching is involved. On top of this
> MultiReader create an IndexSearcher (which is also cheap).
> 
> SearcherManeger's acquire() returns IndexSearcher. The trouble is that
> we need to have the IndexSearcher constructed with certain
> ExecutorService and there does not seem to be a way how to do that with
> SearcherManager.
> 
> I wonder if SearcherManager can be extended to allow this. Otherwise we
> would have to use ReferenceManager and reimplement the functionality
> found in SearcherManager which I'd like to avoid.
> 
> 
> v.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org


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

Reply via email to