Hi,

Script is correct.
So the problem is in Zend_Search.
I've added an issue for this: http://framework.zend.com/issues/browse/ZF-1002


Have I understood correct, that the problem arises only if you update the same document second time?


With best regards,
   Alexander Veremyev.


Uros wrote:
Hi,

see the code bellow:

setlocale(LC_ALL, 'sl_SI.UTF-8');
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new
Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num());
$config = Zend::registry('config');
$index = Zend_Search_Lucene::open(VAR_DIR.$config->lucene->indexdir);

$index->setMaxBufferedDocs(1);
$index->setMaxMergeDocs(1);
$hits = $index->find('item:'.$data['item_id']);
foreach ($hits as $hit) {
        $index->delete($hit->id);
}
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Keyword('stock_number',
mb_strtolower($data['stock_number'],'utf-8')));
$doc->addField(Zend_Search_Lucene_Field::Text('item', $data['item_id']));
$doc->addField(Zend_Search_Lucene_Field::Text('name',
mb_strtolower($data['name'],'utf-8')));
$doc->addField(Zend_Search_Lucene_Field::Text('description',
mb_strtolower($data['description'],'utf-8')));

$doc->addField(Zend_Search_Lucene_Field::UnIndexed('name_original',
$data['name']));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('description_original',
$data['description']));
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('image',
$data['image_name']));
$index->addDocument($doc);

$index->commit();
//$index->optimize();
unset($index);


regards

Uros


Alexander Veremyev wrote:

Could you give an example of indexing and updating script?

Uros wrote:
Hi,
i'm trying to find what may be a problem when updating documents. For now
I

Is there something I'm doing wrong?

regards
Uros




Reply via email to