Hi Jan,
The problem may be caused by field's name.
Use 'contents' instead of 'content'.
Default search field is 'contents'
(http://framework.zend.com/manual/en/zend.search.html#zend.search.index-creation.documents-and-fields).
If you use any other field name, it should be referenced in a search
query (ex. 'content:intergenia').
It's default behavior of Java Lucene, but it's planned to be changed in
near future. (It's planned to search through all fields by default)
If this doesn't help, can I ask you to send me an example of your index?
With best regards,
Alexander Veremyev.
Jan Pieper wrote:
I want to to implement a Lucene based search in my blog but it does not
function. Yesterday morning it works but after I created the index new
nothing works.
--------------------------------------------------------------------------------
$index = new Zend_Search_Lucene($config->search->index, true);
foreach($result as $row)
{
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::UnIndexed(
'created', $row['writedate']
));
$doc->addField(Zend_Search_Lucene_Field::Text(
'title', $row['title']
));
$doc->addField(Zend_Search_Lucene_Field::Text(
'url', $config->site->url.'blog/entry/'.$row['id']
));
$doc->addField(Zend_Search_Lucene_Field::Text(
'content', $row['content']
));
$index->addDocument($doc);
}
$index->commit();
--------------------------------------------------------------------------------
The index will be created and I can search in it with Luke
(http://www.getopt.org/luke/) but if I use the ZF-API nothing will be
found :(
--------------------------------------------------------------------------------
$index = new Zend_Search_Lucene($config->search->index);
$hits = $index->find('intergenia');
foreach ($hits as $hit) {
echo '[' . $hit->score. '] '. hit->title . '<br />';
echo $hit->url . '<br /><br />';
}
--------------------------------------------------------------------------------
Where is the mistake? Is there a chance to use the GermanAnalyzer?
-- Jan