я сохраняю свои поля с этим кодом:
class Places_Search_Document extends Zend_Search_Lucene_Document{
public function __construct($class, $key, $title,$contents, $summary, $createdBy, $dateCreated)
{
$this->addField(Zend_Search_Lucene_Field::Keyword('docRef', "$class:$key"));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('class', $class));
$this->addField(Zend_Search_Lucene_Field::UnIndexed('key', $key));
$this->addField(Zend_Search_Lucene_Field::Keyword('title', $title ,'UTF-8'));
$this->addField(Zend_Search_Lucene_Field::unStored('contents', $contents , 'UTF-8'));
$this->addField(Zend_Search_Lucene_Field::text('summary', $summary , 'UTF-8'));
//$this->addField(Zend_Search_Lucene_Field::UnIndexed('createdBy', $createdBy));
$this->addField(Zend_Search_Lucene_Field::Keyword('dateCreated', $dateCreated));
}
}
Я ищу слово с этим кодом:
$index = Places_Search_Lucene::open(SearchIndexer::getIndexDirectory());
$term = new Zend_Search_Lucene_Index_Term($q);
$query = new Zend_Search_Lucene_Search_Query_Wildcard($term);
$results = $index->find($query);
теперь отлично работает для несортированных и текстовых полей, но не ищет ключевые слова !!