milu07
March 20th, 2008, 05:20 PM
Hello,
My machine is Ubuntu 7.10. I am working with Apache Lucene. I have done with indexer and tried with command line Searcher (the default command line included in Lucene package: http://lucene.apache.org/java/2_3_1/demo2.html). When I use this at command line:
java Searcher -query algorithm
it works and returns a list of results to me. Here 'algorithm' is the keyword to search.
However, I want to have a web search interface written in PHP, I use PHP exec() to call this Searcher from my PHP script:
exec("java Searcher -query algorithm ", $arr, $retVal);
It does not work. I print the value of $retVal, it is 1.
I come back and try: exec("java helloWorld ", $arr, $retVal);
It works and prints out the "hello World" message and $retVal is 0. Here the helloWorld.java has only System.println("hello World"); Notice that the PHP script, helloWorld.java and Searcher.java are in the same directory, which is accessible from the Web.
In the command line Searcher.java of Lucene, it imports many libraries, is this the problem?
[I]import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyz er;
....
Could you please help?
Thank you,
My machine is Ubuntu 7.10. I am working with Apache Lucene. I have done with indexer and tried with command line Searcher (the default command line included in Lucene package: http://lucene.apache.org/java/2_3_1/demo2.html). When I use this at command line:
java Searcher -query algorithm
it works and returns a list of results to me. Here 'algorithm' is the keyword to search.
However, I want to have a web search interface written in PHP, I use PHP exec() to call this Searcher from my PHP script:
exec("java Searcher -query algorithm ", $arr, $retVal);
It does not work. I print the value of $retVal, it is 1.
I come back and try: exec("java helloWorld ", $arr, $retVal);
It works and prints out the "hello World" message and $retVal is 0. Here the helloWorld.java has only System.println("hello World"); Notice that the PHP script, helloWorld.java and Searcher.java are in the same directory, which is accessible from the Web.
In the command line Searcher.java of Lucene, it imports many libraries, is this the problem?
[I]import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyz er;
....
Could you please help?
Thank you,