Ejemplo n.º 1
0
 /**
  * Method to get a list of content items to index.
  *
  * @param   integer         $offset  The list offset.
  * @param   integer         $limit   The list limit.
  * @param   JDatabaseQuery  $sql     A JDatabaseQuery object. [optional]
  *
  * @return  array  An array of FinderIndexerResult objects.
  *
  * @since   2.5
  * @throws  Exception on database error.
  */
 protected function getItems($offset, $limit, $sql = null)
 {
     JLog::add("FinderIndexerAdapter::getItems({$offset}, {$limit})", JLog::INFO);
     // Get the list query.
     $sql = $this->db->getQuery(true);
     $sql->select('id')->from('#__kunena_messages')->where('id>' . $this->db->quote($offset));
     // Get the content items to index.
     $this->db->setQuery($sql, 0, $limit);
     $ids = $this->db->loadColumn();
     // Check for a database error.
     if ($this->db->getErrorNum()) {
         // Throw database error exception.
         throw new Exception($this->db->getErrorMsg(), 500);
     }
     // Convert the items to result objects.
     $messages = KunenaForumMessageHelper::getMessages($ids, 'none');
     $items = array();
     foreach ($messages as &$message) {
         $items[] = $this->createIndexerResult($message);
     }
     KunenaForumMessageHelper::cleanup();
     KunenaRoute::cleanup();
     return $items;
 }