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
>
>
>
--
View this message in context:
http://www.nabble.com/Zend_Search_Lucene---updating-documents-tf3325986s16154.html#a9265004
Sent from the Zend Framework mailing list archive at Nabble.com.