public function fetch($limit = 10, $offset = 0) { $fieldsToReturn = array(); foreach (ITNewsletterPost::fields() as $field) { $fieldsToReturn[] = $field['solr_identifier']; } $solrFetchParams = array('SearchOffset' => $offset, 'SearchLimit' => $limit, 'Facet' => $this->facets, 'SortBy' => array('published' => 'desc'), 'Filter' => $this->filters, 'SearchContentClassID' => array(ITNewsletterPost::CLASS_IDENTIFIER), 'SearchSectionID' => null, 'SearchSubTreeArray' => array(eZINI::instance('content.ini')->variable('NodeSettings', 'RootNode')), 'AsObjects' => false, 'SpellCheck' => null, 'IgnoreVisibility' => null, 'Limitation' => null, 'BoostFunctions' => null, 'QueryHandler' => 'ezpublish', 'EnableElevation' => true, 'ForceElevation' => true, 'SearchDate' => null, 'DistributedSearch' => null, 'FieldsToReturn' => $fieldsToReturn, 'SearchResultClustering' => null, 'ExtendedAttributeFilter' => array()); $solrSearch = new eZSolr(); $tmp = $solrSearch->search($this->query, $solrFetchParams); return $tmp; }
/** * @param array $result * * @return ITNewsletterPost */ public static function instanceFromEzfindResultArray(array $result) { $data = array(); $data['object_id'] = $result['id']; foreach (ITNewsletterPost::fields() as $field) { $data[$field['object_property']] = isset($result['fields'][$field['solr_identifier']]) ? $result['fields'][$field['solr_identifier']] : null; } return new ITNewsletterPost($data); }