コード例 #1
0
     $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");
             $resultList->add($title . "\n" . $content);
         }
         java_end_document();
     }
 }