Exemplo n.º 1
0
	/**
	 * Returns the search index
	 *
	 * @return Zend_Search_Lucene_Interface
	 */
	static function GetIndex(){
		if (!self::$index) {
			try {
				self::$index = Zend_Search_Lucene::open(SEARCH_DB_PATH);
			} catch (Exception $err) {
				self::$index = new Zend_Search_Lucene(SEARCH_DB_PATH, true); 
			}
		}
		return self::$index;
	}
Exemplo n.º 2
0
	public function save() {
		if (strlen($this->getContent()) > 65535) {
			// TEXT type has a limit of 65535
			$this->setContent(utf8_safe(substr($this->getContent(), 0, 65535)));
		}
		if (!(defined('LUCENE_SEARCH') && LUCENE_SEARCH)) {
			return parent::save();
		} else {
			LuceneDB::AddToIndex($this);
			parent::save();
		}
	}