有关php调用lucene(JAVA)代码的问题
最近想使用网页显示Lucene搜索的结果,网上说用Php和javabridge可以,但是,我使用javabridge里面的example或者自己写的类都不行。
apache2.2+php5+mysql
现在是可以调用java自己的类如java.lang.String,但是自己写的不行啊。。。而且javabridge里面有一个例子是这样的:
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php include_once ("java/Java.inc");java_autoload("lucene.jar");use java\lang\System as SYS;use java\io as IO;use java\util as Util;use org\apache\lucene as Lucene;try { echo "indexing ... "; /* create the index files in the tmp dir */ $tmp = create_index_dir(); $analyzer = new Lucene\analysis\standard\StandardAnalyzer(); $writer = new Lucene\index\IndexWriter($tmp, $analyzer, true); $file = new IO\File(getcwd()); $files = $file->listFiles(); assert (!java_is_null($files)); foreach($files as $f) { $doc = new Lucene\document\Document(); $doc->add(new Lucene\document\Field( "name", $f->getName(), Lucene\document\Field::type("Store")->YES, Lucene\document\Field::type("Index")->UN_TOKENIZED)); $writer->addDocument($doc); }................................................