$resultList = new java("java.util.LinkedList"); $queryparser = new java("org.apache.lucene.queryParser.QueryParser", "title", $analyzer); $_qobj = $queryparser->parse($_q); foreach ($plugins as $plugin) { if ($plugin->type == 'SearchLucene') { $startDate = date('Y/m/d H:i'); if (!isset($dispatcher) || !is_object($dispatcher)) { $dispatcher =& JDispatcher::getInstance(); } $path = JPATH_PLUGINS . DS . $plugin->type . DS . $plugin->name . '.php'; $className = 'plg' . $plugin->type . $plugin->name; require_once $path; $instance = new $className($dispatcher, $plugin); $pluginindex = $indexpath . DS . $plugin->name; $index = new java("java.io.File", $pluginindex); if (!$index->exists()) { continue; } $searcher = new java("org.apache.lucene.search.IndexSearcher", $index); $phrase = new java("org.apache.lucene.search.MatchAllDocsQuery"); $hits = $searcher->search($phrase); //$hits = $searcher->search($_qobj); $n = java_values($hits->length()); echo $n . " results for " . $plugin->name . "\n"; if ($n > 0) { $iter = $hits->iterator(); java_begin_document(); while ($n--) { $next = $iter->next(); $title = $next->get("title"); $content = $next->get("summary");
<?php /** adjust these values **/ $J2EE_LIBRARY_DIR = "/opt/SUNWappserver/lib"; $HOST = "127.0.0.1"; $PORT = 8080; /** * Import the web service definition and compile it to java classes, * so that the communication can be debugged easily. */ $SERVICE = "jaxws-fromwsdl/addnumbers?wsdl"; // require J2EE web service libraries $here = getcwd(); $ws_libs = "-Djava.ext.dirs={$J2EE_LIBRARY_DIR}"; java_require("{$here};{$J2EE_LIBRARY_DIR}"); // compile wsdl, if necessary $stub = new java("java.io.File", "{$here}/org"); if (java_is_false($stub->exists())) { $java = ini_get("java.java"); if (!$java) { $java = "java"; } echo "Compiling http://{$HOST}:{$PORT}/{$SERVICE} ..."; system("{$java} {$ws_libs} com.sun.tools.ws.WsImport -keep http://{$HOST}:{$PORT}/{$SERVICE}"); echo "done.\nStubs created in {$here}/org directory.\n"; }