lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Imbeault <>
Subject Indexsearcher - one instance in PHP via javabridge?
Date Wed, 02 Aug 2006 05:59:04 GMT
Hello everyone,

I'm having tons of fun right now with Lucene indexing a large (15 
millions documents) library. I'm developing the web front end, and I 
read on this mailing list that it's better to have one instance of 

I'm using Lucene in PHP via JavaBridge (and Tomcat), but I can't figure 
out how to instantiate an unique copy of IndexSearcher, somehow get it 
in my webpage for each thread, and destroy it before I add stuff to the 
index (at the end of each day).

I'm trying to follow these instructions, but I have zero experience with 
Java, JVMs, Tomcat, etc. Could somebody help me with this one? Thanks in 

I commend you for giving all the information that's relevant. For the sake
of simplicity, and because it is the vast majority of use cases, could you
endorse the following as the simplest, most correct way (i.e. a best
practice) to implement Lucene for Web applications.

1- create an IndexSearcher instance in the servlet's init() method, and
cache it in the web application context,

2- in the doGet or doPost() methods, lookup the index searcher instance in
the web application context and use it to run queries,

3- close the IndexSearcher in the destroy() method.

This is *simple*, and *correct*. It doesn't create a new IndexSearcher per
query, doesn't use a static field, nor a singleton, nor a pool. All ideas
that have been suggested but have issues, or are more difficult to

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message