Example #1
0
 /**
  * Search and return results
  * Called from SearchController::resultsAction
  * Required by abstract parent
  *
  * @param Query $search         search object
  * @param int $start            [optional] starting record number
  * @param int $max              [optional] max records
  * @param string $sort          [optional] sort order
  *
  * @return Results
  */
 public function searchRetrieve(Search\Query $search, $start = 0, $max = 100, $sort = "")
 {
     $start = $start - 1;
     // allow for pz2 starting from 0
     $max = $max - 1;
     $results = $this->client->pz2_show($start, $max, $sort);
     $pzt = new Targets(null, array_keys($search->getTargetLocations()));
     $result_set = new MergedResultSet($results, $pzt);
     // fetch facets
     // only if facets should be shown and there are more than facet_min results
     if ($this->conf()->getConfig('FACET_FIELDS', false) == true && $result_set->total > $this->conf()->getConfig('FACET_MIN', false)) {
         $terms = array_keys($this->conf()->getFacets());
         $xml = $this->client->pz2_termlist($terms, $this->conf()->getConfig('FACET_MAX', false));
         $facets = $this->extractFacets($xml);
         $result_set->setFacets($facets);
     }
     return $result_set;
 }