You only need one SearcherManager instance for every IndexWriter you have
open (basically, one for your application).  The SearcherManager class is
thread-safe- that's the point- so all threads can retrieve their
IndexSearchers from it without any additional synchronization in your code.
 So you can use it as a singleton if you'd like (although singletons in
general are often a bad idea, for reasons that have nothing to do with
Lucene).

On Fri, Jan 6, 2012 at 10:44 PM, chenhan <chenhan...@gmail.com> wrote:

> hi,
> i'm writing a normal web-search application with lucene 3.5.0. in version
> 3.5.0 lucene provides SearcherManager to manage multithreaded searching.
> but i don't know how to use this class. should i use it as singleton, or
> should i initialize an instance for each searching?
>
> expect for your reply! thank you!
>
> --
> chenhan
> Sent with Sparrow
>

Reply via email to