Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1.     public function updateLuceneIndex() {
  2.         $index = ArticleTable::getLuceneIndex();
  3.  
  4.  
  5.         foreach ($index->find('pk:' . $this->getId()) as $hit) {
  6.             $index->delete($hit->id);
  7.         }
  8.            print_r  ($this->getId());
  9.  
  10.         $doc = new Zend_Search_Lucene_Document();
  11.  
  12.  
  13.         $doc->addField(Zend_Search_Lucene_Field::Keyword('pk', $this->getId()));
  14.  
  15.         // индексируем поля вакансии
  16.         $doc->addField(Zend_Search_Lucene_Field::UnStored('title', $this->getTitle(), 'utf-8'));
  17.         $doc->addField(Zend_Search_Lucene_Field::UnStored('body', $this->getBody(), 'utf-8'));
  18.  
  19.         // добавляем работу в индекс
  20.         $index->addDocument($doc);
  21.         $index->commit();
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement