Exemplo n.º 1
0
 private function insertSearchWord($strText, $intId)
 {
     foreach ($this->getWords($strText, self::SEARCH_WEIGHT) as $strWord => $intWeight) {
         $objSearchIndex = new SearchIndex();
         $objSearchIndex->setElementId($intId);
         $objSearchIndex->setWord($strWord);
         $objSearchIndex->setCount($intWeight);
         $objSearchIndex->save();
     }
 }
Exemplo n.º 2
0
 public function updateSearchIndex()
 {
     // update search index
     $c = new Criteria();
     $c->add(SearchIndexPeer::QUESTION_ID, $this->getId());
     SearchIndexPeer::doDelete($c);
     foreach ($this->getWords() as $word => $weight) {
         $index = new SearchIndex();
         $index->setQuestionId($this->getId());
         $index->setWord($word);
         $index->setWeight($weight);
         $index->save();
     }
 }