/** * Initiate the search with pazpar2 for this set of targets * @param Query $query * @param integer max_recs Maximum total records to fetch (optional) */ public function search(Query $query, $max_recs = null) { if (isset($query->limits) && sizeof($query->limits) > 0) { $terms = array(); foreach ($query->limits as $limit_term) { $facets[] = urlencode(preg_replace('/facet\\./', '', $limit_term->field) . $limit_term->relation . $limit_term->value); } } else { $facets = null; } // calculate records per target to retrieve (a fixed total, divided by // number of targets) if ($max_recs == null) { // if max_recs not set by user, use default from configuration $max_recs = $this->conf()->getConfig('MAX_RECORDS', false); } $targets = $query->getTargetLocations(); $no_recs = floor($max_recs / count($targets)); // start the search $sid = $query->sid; $this->client($sid)->search($query->toQuery(), $targets, $facets, $no_recs); }
/** * Initiate the search with pazpar2 for this set of targets * * @return Query */ public function search(Query $query, $start = 0, $max = 100) { // flesh out target information from the kb $query->fillTargetInfo(); if (isset($query->limits) && sizeof($query->limits) > 0) { $terms = array(); foreach ($query->limits as $limit_term) { $facets[] = urlencode(preg_replace('/facet\\./', '', $limit_term->field) . $limit_term->relation . $limit_term->value); } } else { $facets = null; } $maxrecs = $this->conf()->getConfig('RECORDS_PER_TARGET', false); // start the search $sid = $query->sid; $this->client($sid)->search($query->toQuery(), $query->getTargetIDs(), $facets, $maxrecs); }