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).
The actual search and caching is always executed on the segments collected from all indexes, the wrapping with MultiReaders and IndexSearchers is neglectible. 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: Monday, July 18, 2016 5:00 PM > To: java-user@lucene.apache.org > Subject: Re: MmapDirectory and IndexReader reuse > > On 07/15/16 12:00 PM, Uwe Schindler wrote: > > Hi, > > > > You should keep the IndexReader open for the whole time! Otherwise > there are more bottlenecks and slowdowns. > > > > If you are updating the Index, you should use SearcherManager that > reopens the index reader accordingly. After updating the index you should > also not completely close and reopen the index. SearcherManager uses the > DirectoryReader.reopen() method, which just updates the "view" currently > seen and involves minimal syscalls (none at all if nothing changes). > > Is it somehow possible to use SearcherManager with MultiReader to search > multiple indexes ? We need to have the IndexSearcher to be constructed > from multiple IndexReaders and the executor with distinct thread pool. > Looking at the documentation there does not seem to be a way to do that > as the SearcherManager constructor works only on single directory. > > > 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