/** * Returns the stored list of facets for the last search * * @param array $filter Array of field => on-screen description listing * all of the desired facet fields; set to null to get all configured values. * * @return array Facets data arrays */ public function getFacetList($filter = null) { $list = parent::getFacetList($filter); // Append date range facet to the list so that it gets // included even when facet counts are zero. if (!isset($list[Params::SPATIAL_DATERANGE_FIELD]) && (is_null($filter) || isset($filter[Params::SPATIAL_DATERANGE_FIELD]))) { // Resolve facet index in list $ind = 0; $filter = $filter ?: $this->getParams()->getFacetConfig(); if (!isset($filter[Params::SPATIAL_DATERANGE_FIELD])) { return $list; } foreach (array_keys($filter) as $field) { if ($field == Params::SPATIAL_DATERANGE_FIELD) { break; } $ind++; } $data = []; $filter = $filter[Params::SPATIAL_DATERANGE_FIELD]; $data['label'] = $filter; $data['list'] = $filter; $list = array_slice($list, 0, $ind) + [Params::SPATIAL_DATERANGE_FIELD => $data] + array_slice($list, $ind); } return $list; }
/** * Constructor * * @param \VuFind\Search\Base\Params $params Object representing user search * parameters. */ public function __construct($params) { // Call parent constructor: parent::__construct($params); // Set up URL helper to use appropriate search parameter: $this->getUrlQuery()->setBasicSearchParam('author'); }
/** * Returns the stored list of facets for the last search * * @param array $filter Array of field => on-screen description listing * all of the desired facet fields; set to null to get all configured values. * * @return array Facets data arrays */ public function getFacetList($filter = null) { $list = parent::getFacetList($filter); // Append date range facet to the list so that it gets // included even when facet counts are zero. $dateRangeField = $this->getParams()->getDateRangeSearchField(); if (!isset($list[$dateRangeField]) && (null === $filter || isset($filter[$dateRangeField]))) { // Resolve facet index in list $ind = 0; $filter = $filter ?: $this->getParams()->getFacetConfig(); if (!isset($filter[$dateRangeField])) { return $list; } foreach (array_keys($filter) as $field) { if ($field == $dateRangeField) { break; } $ind++; } $data = []; $filter = $filter[$dateRangeField]; $data['label'] = $filter; $data['list'] = $filter; $list = array_slice($list, 0, $ind) + [$dateRangeField => $data] + array_slice($list, $ind); } return $list; }
/** * Support method for getVisData() -- filter bad values from facet lists. * * @param array $fields Processed date information from * processDateFacets * @param \VuFind\Search\Solr\Results $results Search results object * * @return array */ protected function processFacetValues($fields, $results) { $facets = $results->getFullFieldFacets(array_keys($fields)); $retVal = array(); foreach ($facets as $field => $values) { $newValues = array('data' => array()); foreach ($values['data']['list'] as $current) { // Only retain numeric values! if (preg_match("/^[0-9]+\$/", $current['value'])) { $newValues['data'][] = array($current['value'], $current['count']); } } $retVal[$field] = $newValues; } return $retVal; }
/** * Constructor * * @param \VuFind\Search\Base\Params $params Object representing user search * parameters. */ public function __construct(\VuFind\Search\Base\Params $params) { parent::__construct($params); $this->backendId = 'SolrAuth'; }
/** * Get a connection to the Solr index. * * @param null|array $shards Selected shards to use (null for defaults) * @param string $index ID of index/search classes to use (this assumes * that \VuFind\Search\$index\Options and \VuFind\Connection\$index are both * valid classes) * * @return \VuFind\Connection\Solr */ public function getSolrConnection($shards = null, $index = 'SolrReserves') { return parent::getSolrConnection($shards, $index); }