예제 #1
0
 function getDocumentPart(Search_Type_Factory_Interface $typeFactory)
 {
     $item = $this->getValue();
     $baseKey = $this->getBaseKey();
     $out = array($baseKey => $typeFactory->numeric($item));
     return $out;
 }
예제 #2
0
 function getData($objectType, $objectId, Search_Type_Factory_Interface $typeFactory, array $data = array())
 {
     $data = '';
     if ($objectType == 'forum post') {
         $forumId = $this->commentslib->get_comment_forum_id($objectId);
         $comment_count = $this->commentslib->count_comments_threads("forum:{$forumId}", $objectId);
     } else {
         $comment_count = $this->commentslib->count_comments("{$objectType}:{$objectId}");
         $data = implode(' ', $this->table->fetchColumn('data', array('object' => $objectId, 'objectType' => $objectType)));
     }
     return array('comment_count' => $typeFactory->numeric($comment_count), 'comment_data' => $typeFactory->plaintext($data));
 }
예제 #3
0
 /**
  * Return data array of last post for thread
  *
  * @param $threadId
  * @param Search_Type_Factory_Interface $typeFactory
  * @return array
  * @throws Exception
  */
 function getForumLastPostData($threadId, Search_Type_Factory_Interface $typeFactory)
 {
     $commentslib = TikiLib::lib('comments');
     $commentslib->extras_enabled(false);
     $comment = $commentslib->get_lastPost($threadId);
     $lastModification = isset($comment['commentDate']) ? $comment['commentDate'] : 0;
     $content = isset($comment['data']) ? $comment['data'] : '';
     $snippet = TikiLib::lib('tiki')->get_snippet($content);
     $author = array(isset($comment['userName']) ? $comment['userName'] : '');
     $commentslib->extras_enabled(true);
     $data = array('lastpost_title' => $typeFactory->sortable(isset($comment['title']) ? $comment['title'] : ''), 'lastpost_modification_date' => $typeFactory->timestamp($lastModification), 'lastpost_contributors' => $typeFactory->multivalue(array_unique($author)), 'lastpost_post_content' => $typeFactory->wikitext($content), 'lastpost_post_snippet' => $typeFactory->plaintext($snippet), 'lastpost_hits' => $typeFactory->numeric(isset($comment['hits']) ? $comment['hits'] : 0), 'lastpost_thread_id' => $typeFactory->identifier(isset($comment['thread_id']) ? $comment['thread_id'] : 0));
     return $data;
 }
예제 #4
0
 function getDocumentPart($baseKey, Search_Type_Factory_Interface $typeFactory)
 {
     $data = $this->gatherVoteData();
     return array($baseKey => $typeFactory->numeric($data['voteavg']), "{$baseKey}_count" => $typeFactory->numeric($data['numvotes']), "{$baseKey}_sum" => $typeFactory->numeric($data['total']));
 }