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 Michael Imbeault <mi...@sympatico.ca> on 2006/08/02 07:59:04 UTC

Indexsearcher - one instance in PHP via javabridge?

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 
IndexSearcher.

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 
advance!

Instructions:
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
implement.

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


Re: Indexsearcher - one instance in PHP via javabridge?

Posted by Michael Imbeault <mi...@sympatico.ca>.
Wow thanks, this is such a good answer that I wasn't expecting that much 
:-) It looks like it could resolve all my problems at once!

Thanks a lot!

Mike

Chris Hostetter wrote:
> : 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
> : advance!
>
> if you want to eliminate your need to write java code (or servlets)
> completely take a look at Solr ... it provides a webservicesish API
> for indexing and searching, and handles all of the Lucene "best
> practices" for you...
>
> http://incubator.apache.org/solr/
> http://incubator.apache.org/solr/tutorial.html
>
> There's even some examples on the wiki about how to talk to Solr via PHP
> (but i don't really know anything about PHP so I can't comment on the
> quality of the code)
>
> http://wiki.apache.org/solr/SolPHP
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.or

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


Re: Indexsearcher - one instance in PHP via javabridge?

Posted by Chris Hostetter <ho...@fucit.org>.
: 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
: advance!

if you want to eliminate your need to write java code (or servlets)
completely take a look at Solr ... it provides a webservicesish API
for indexing and searching, and handles all of the Lucene "best
practices" for you...

http://incubator.apache.org/solr/
http://incubator.apache.org/solr/tutorial.html

There's even some examples on the wiki about how to talk to Solr via PHP
(but i don't really know anything about PHP so I can't comment on the
quality of the code)

http://wiki.apache.org/solr/SolPHP



-Hoss


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