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

Reply via email to