/** * init * * 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) { $filters = $params->getFilters(); foreach ($filters as $key => $value) { if ($key == $this->geoField) { $match = array(); if (preg_match('/Intersects\\(([0-9 \\-\\.]+)\\)/', $value[0], $match)) { $this->selectedCoordinates = explode(' ', $match[1]); $coords = $match[1]; $params->addBoostFunction("geo_overlap('{$coords}', bbox_geo_str)"); } else { if (preg_match($this->polygonMatch, $value[0], $match)) { $this->selectedCoordinates = [$match[1], $match[2], $match[3], $match[4]]; $coords = $match[1] . ' ' . $match[2] . ' ' . $match[3] . ' ' . $match[4]; $params->addBoostFunction("geo_overlap('{$coords}', bbox_geo_str)"); } } } } }