Ejemplo n.º 1
0
 /**
  * Index a single document
  *
  * @param Client $client
  * @param Posts  $post
  */
 protected function _doIndex($client, $post)
 {
     $karma = $post->getNumberViews() + 0 + $post->getNumberReply();
     if ($karma > 0) {
         $params = [];
         $params['body'] = ['id' => $post->getId(), 'title' => $post->getTitle(), 'content' => $post->getContent(), 'karma' => $karma];
         $params['index'] = $this->index;
         $params['type'] = $this->type;
         $params['id'] = 'post-' . $post->getId();
         $ret = $client->index($params);
         var_dump($ret);
     }
 }