Hi all,

I'm currently having problem with indexing my website with Zend_Search_Lucene. Hope someone could help me out.

I am able to properly create an index and add all relevant documents. I add Keyword field that contains url of the document to be able to find it later for update. And this is the problem: when i fire up the query for url field ('url:http\://www.example.com') i get no hits.

The index seems to be OK as I browse it using Luke (Java Lucene Index Toolbox), also the query works and I get wanted result.

The code is following:

--------
$doc = Zend_Search_Lucene_Document_Html::loadHTML($response_html);
$doc->addField(Zend_Search_Lucene_Field::Keyword('url', $url));
$doc->addField(Zend_Search_Lucene_Field::Text('md5', md5($response_html)));
$index->addDocument($doc);
...
--------
...
Zend_Search_Lucene::setDefaultSearchField('url');
$q = 'url:http\://www.example.net/';
$hits = $index->find($q);
foreach ($hits as $hit) {
    echo 'Hit! '.$hit->id."\n";
}
--------

Thanks for every idea.

JB

Reply via email to