/** * Set parameters based on a search object * * @param \Zend\StdLib\Parameters $request Parameter object representing user * request. * * @return void */ public function initFromRequest($request) { parent::initFromRequest($request); // Force custom facet settings: $this->facetConfig = array(); $this->addFacet('authorStr'); $this->setFacetOffset(($this->getPage() - 1) * $this->getLimit()); $this->setFacetLimit($this->getLimit() * 10); // Sorting - defaults to off with unlimited facets, so let's // be explicit here for simplicity. if ($this->getSort() == 'author') { $this->setFacetSort('index'); } else { $this->setFacetSort('count'); } }
/** * Pull the search parameters * * @param \Zend\StdLib\Parameters $request Parameter object representing user * request. * * @return void */ public function initFromRequest($request) { // Check for advanced search from VuFind1 missing join and/or bool parameter: if (null === $request->get('lookfor')) { if (null === $request->get('join')) { $request->set('join', 'AND'); } $bool0 = $request->get('bool0'); if (!is_array($bool0) || empty(array_filter($bool0))) { $request->set('bool0', ['AND']); } } // Check for VuFind1 orfilters and convert them: if ($orFilters = $request->get('orfilter')) { $filters = $request->get('filter', []); foreach ($orFilters as $filter) { $filters[] = "~{$filter}"; } $request->set('filter', $filters); $request->set('orfilter', null); } parent::initFromRequest($request); $this->setDebugQuery($request->get('debugSolrQuery', false)); }
/** * Pull the search parameters * * @param \Zend\StdLib\Parameters $request Parameter object representing user * request. * * @return void */ public function initFromRequest($request) { if (null === $this->collectionID) { throw new \Exception('Collection ID missing'); } if (null === $this->collectionField) { throw new \Exception('Collection field missing'); } parent::initFromRequest($request); // We don't spellcheck this screen; it's not for free user input anyway $options = $this->getOptions(); $options->spellcheckEnabled(false); // Prepare the search $safeId = addcslashes($this->collectionID, '"'); $options->addHiddenFilter($this->collectionField . ':"' . $safeId . '"'); $options->addHiddenFilter('!id:"' . $safeId . '"'); }