Hi, the problem arises in other cases to. What I found is that until I call optimize manualy changes in index is not seen or maybe just a partial. If updating same documents I end up with many duplicates.
regards Uros Alexander Veremyev wrote: > > 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 >>> >>> >> > > > -- View this message in context: http://www.nabble.com/Zend_Search_Lucene---updating-documents-tf3325986s16154.html#a9265248 Sent from the Zend Framework mailing list archive at Nabble.com.
