【发布时间】:2015-03-23 11:46:18
【问题描述】:
public function searchIndex($entity)
{
//http://framework.zend.com/manual/2.0/en/modules/zendsearch.lucene.searching.html#
//http://stackoverflow.com/questions/7805996/zend-search-lucene-matches
//http://framework.zend.com/manual/2.0/en/modules/zendsearch.lucene.index-creation.html
try {
$index = Lucene::open( $this->getOptions()->getIndexDir() );
$index->optimize();
echo '<p>Index optimized.</p>';
} catch (Exception $e) {
throw new Exception("Search index not configured", 1);
}
$query = QueryParser::parse( $entity->getTerm() );
$hits = $index->find($query);
//print_r($hits);
$entity->setCount( count( $hits ) );
//save the search for reference
$this->create($entity);
return $hits;
}
每次我在我的 zend 网站中执行搜索时,它给我的结果为零,请告诉我如何在 zend 中执行重新索引。
【问题讨论】:
标签: zend-framework lucene zend-search-lucene