Beispiel #1
0
 public function main()
 {
     $srcdir = realpath(dirname(__FILE__) . '/../../../');
     $zend_path = $srcdir . '/demos/quickstart/protected/index';
     set_include_path(get_include_path() . PATH_SEPARATOR . realpath($zend_path));
     require_once 'Zend/Search/Lucene.php';
     require_once $srcdir . '/buildscripts/index/api_index.php';
     $api = new api_index($this->todir, realpath($this->docdir));
     $api->create_index();
 }
Beispiel #2
0
$api_target = realpath(dirname(__FILE__) . '/../../demos/quickstart/protected/index/api/');
//get the ZEND framework
$zend_path = realpath(dirname(__FILE__) . '/../../demos/quickstart/protected/index');
set_include_path(get_include_path() . ';' . $zend_path);
require_once 'Zend/Search/Lucene.php';
//get the indexers.
include 'quickstart_index.php';
include 'api_index.php';
if (isset($argv[1])) {
    if (strtolower($argv[1]) == "quickstart") {
        $quickstart = new quickstart_index($quickstart_target, $quickstart_base, $quickstart_source);
        $quickstart->create_index();
    } else {
        if (strtolower($argv[1]) == "api") {
            $api = new api_index($api_target, $api_source);
            $api->create_index();
        } else {
            $q = new Zend_Search_Lucene($quickstart_target);
            $query = $argv[1];
            $hits = $q->find(strtolower($query));
            echo "Found " . count($hits) . " for " . $query . " in quick start\n";
            foreach ($hits as $hit) {
                echo "   " . $hit->title . "\n";
            }
            $a = new Zend_Search_Lucene($api_target);
            $query = $argv[1];
            $hits = $a->find(strtolower($query));
            echo "\nFound " . count($hits) . " for " . $query . " in API\n";
            foreach ($hits as $hit) {
                echo "   " . $hit->link . "\n";
            }