You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Vinicius Carvalho <vi...@gmail.com> on 2008/05/29 20:26:54 UTC

Single IndexReader vs Single IndexSearcher

Hello there! My application uses multiple indexes, so I create a multireader
based on my indexreaders. What I've done is create a Map of Readers, and
whenever the user needs a reader I iterate over my collection, checking if
it is the current index, if not I reopen it, else, I add it to my
multireader.

So, for each thread I have a new MultiReader, but my readers are kept open
for a long period (few updates to the index, many reads). But I also create
a new Searcher based on the Multireader for each thread. On the faqs it says
that we should have only one searcher as well. The overhead of the searcher
creation is due to the reader it uses or it has an internal overhead forcing
other to have a single instance of it as well?

Regards

-- 
"In a world without fences and walls, who needs Gates and Windows?"

Re: Single IndexReader vs Single IndexSearcher

Posted by Mark Miller <ma...@gmail.com>.
Vinicius Carvalho wrote:
> Hello there! My application uses multiple indexes, so I create a multireader
> based on my indexreaders. What I've done is create a Map of Readers, and
> whenever the user needs a reader I iterate over my collection, checking if
> it is the current index, if not I reopen it, else, I add it to my
> multireader.
>
> So, for each thread I have a new MultiReader, but my readers are kept open
> for a long period (few updates to the index, many reads). But I also create
> a new Searcher based on the Multireader for each thread. On the faqs it says
> that we should have only one searcher as well. The overhead of the searcher
> creation is due to the reader it uses or it has an internal overhead forcing
> other to have a single instance of it as well?
>
> Regards
>
>   
99.9% of the overhead is the reader...if your caching that there is 
little value in caching the searcher.

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