/** * Called at the end of the Search Params objects' initFromRequest() method. * This method is responsible for setting search parameters needed by the * recommendation module and for reading any existing search parameters that may * be needed. * * @param \VuFind\Search\Base\Params $params Search parameter object * @param \Zend\StdLib\Parameters $request Parameter object representing user * request. * * @return void */ public function init($params, $request) { // See if we can determine the label for the current search type; first // check for an override in the GET parameters, then look at the incoming // params object.... $typeLabel = $request->get('typeLabel'); $type = $request->get('type'); if (empty($typeLabel) && !empty($type)) { $typeLabel = $params->getOptions()->getLabelForBasicHandler($type); } // Extract a search query: $lookfor = $request->get($this->requestParam); if (empty($lookfor) && is_object($params)) { $lookfor = $params->getQuery()->getAllTerms(); } // Set up the parameters: $this->results = $this->resultsManager->get($this->getSearchClassId()); $params = $this->results->getParams(); $params->setLimit($this->limit); $params->setBasicSearch($lookfor, $params->getOptions()->getHandlerForLabel($typeLabel)); // Perform the search: $this->results->performAndProcessSearch(); }