コード例 #1
0
 /**
  * The constructor for PHP Lucene
  *
  * @param boolean $create Optional. If true, the lucene index will be recreated.
  */
 public function __construct()
 {
     parent::__construct();
     $config =& KTConfig::getSingleton();
     $javaServerUrl = $config->get('indexer/javaLuceneURL');
     $this->lucene = XmlRpcLucene::get($javaServerUrl);
 }
コード例 #2
0
 /**
  * The constructor for PHP Lucene
  *
  * @param boolean $create Optional. If true, the lucene index will be recreated.
  */
 public function __construct($catchException = false)
 {
     parent::__construct();
     $config =& KTConfig::getSingleton();
     $indexPath = $config->get('indexer/luceneDirectory');
     try {
         $this->lucene = new Zend_Search_Lucene($indexPath, false);
     } catch (Exception $ex) {
         $this->lucene = null;
         if (!$catchException) {
             throw $ex;
         }
     }
 }
コード例 #3
0
 /**
  * The constructor for PHP Lucene
  *
  * @param boolean $create Optional. If true, the lucene index will be recreated.
  */
 public function __construct($catchException = false)
 {
     parent::__construct();
     $config =& KTConfig::getSingleton();
     $indexPath = $config->get('indexer/luceneDirectory');
     try {
         $this->lucene = new Zend_Search_Lucene($indexPath, false);
     } catch (Exception $ex) {
         if ($ex->getMessage() == "Index doesn't exists in the specified directory.") {
             $this->lucene = new Zend_Search_Lucene($indexPath, true);
         } else {
             $this->lucene = null;
             if (!$catchException) {
                 throw $ex;
             }
         }
     }
 }