Ejemplo n.º 1
0
 /**
  * 更新查询索引表
  * 
  * @param  object $object
  * @param  array $data
  * @param boolean $isEdit false的时候为增加,true的时候为edit
  * @return boolean
  */
 private function saveSeachFullText($object, \App\Services\Admin\Content\Param\ContentSave $data, $isEdit = false)
 {
     $spliterObject = new Spliter();
     $titleSplited = $spliterObject->utf8Split($data['title']);
     $index['title'] = $titleSplited['words'];
     $contentSplited = $spliterObject->utf8Split(strip_tags($data['content']));
     $index['content'] = $contentSplited['words'];
     $summarySplited = $spliterObject->utf8Split(strip_tags($data['summary']));
     $index['summary'] = $summarySplited['words'];
     $index['article_id'] = $checkIndex['article_id'] = $object->contentAutoId;
     if ($isEdit === false) {
         $index['added_date'] = $index['edited_date'] = time();
     }
     if ($isEdit === true) {
         $index['edited_date'] = time();
     }
     $indexModel = new SearchIndexModel();
     $result = $indexModel->saveIndex($checkIndex, $index);
     if ($result === false) {
         throw new Exception("save article dict index error.");
     }
 }
Ejemplo n.º 2
0
 /**
  * 删除文章的搜索索引
  *
  * @param array $articleIds 文章的IDs
  */
 private function deleteArticleDictIndex($articleIds)
 {
     $indexModel = new SearchIndexModel();
     $result = $indexModel->deleteArticleDictIndex($articleIds);
     if ($result === false) {
         throw new Exception("delete article dict index error.");
     }
 }