Hi, You are wrong. In ur case (If I ignore any updates to index) , One IndexSearcher object is enough. IndexSearcher is thread safe.
Jelda > -----Original Message----- > From: heritrix.lucene [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 27, 2006 10:58 AM > To: java-user@lucene.apache.org > Subject: Re: IndexSearcher in Servlet > > Hi, > The same question i asked yesterday. :-) And now i know the answer :0 > > Creating a new searcher for each query will make your > application very very slow....... (leave this idea) U can not > have a static indexsearcher object. It will merge all results > and the user will get the result of their query alongwith the > others :-) > > > The method that i am adopting is, i'll create a pool of > static searchers. > and on every request the servlet will request a free searcher > object from the pool. When he is done with that pool. it'll > return back the searcher object to that pool. This way i'll > reuse my searcher objects. > > > On 6/27/06, Fabrice Robini <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > > > > > I have a question about the IndexSearcher(). > > > > I have a Servlet that has a searchDocument(String theQuery) method. > > > > These method instantiate a new IndexSearcher at each query: > > > > > > > > searchDocument(String theQuery) > > > > { > > > > Searcher searcher = new IndexSearcher(indexPath); > > > > . > > > > } > > > > > > > > Is it a good way ? Or Is it better to use a static > searcher, and use > > the same for each query (and for each user). > > > > Is it thread safe ? Will results not be mixed to users ? (if user A > > searchs car and user B searchs boats, is it sure that user > A will get > > car and B will get boats, even if the IndexSearcher is > static and is > > the same ?) > > > > > > > > Thanks a lot, > > > > > > > > Fab > > > > > > -- > > No virus found in this outgoing message. > > Checked by AVG Free Edition. > > Version: 7.1.394 / Virus Database: 268.9.5/376 - Release Date: > > 26/06/2006 > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]