/** * Factory for Solr results object. * * @param ServiceManager $sm Service manager. * * @return Solr */ public static function getSolr(ServiceManager $sm) { $factory = new PluginFactory(); $solr = $factory->createServiceWithName($sm, 'solr', 'Solr'); $config = $sm->getServiceLocator()->get('VuFind\\Config')->get('config'); $spellConfig = isset($config->Spelling) ? $config->Spelling : null; $solr->setSpellingProcessor(new \VuFind\Search\Solr\SpellingProcessor($spellConfig)); return $solr; }
/** * Create a service for the specified name. * * @param ServiceLocatorInterface $serviceLocator Service locator * @param string $name Name of service * @param string $requestedName Unfiltered name of service * * @return object */ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { $params = $serviceLocator->getServiceLocator()->get('VuFind\\SearchParamsPluginManager')->get($requestedName); $class = $this->getClassName($name, $requestedName); if (class_exists($class)) { return new $class($params); } else { $this->defaultNamespace = 'VuFind\\Search'; return parent::createServiceWithName($serviceLocator, $name, $requestedName); } }
/** * Create a service for the specified name. * * @param ServiceLocatorInterface $serviceLocator Service locator * @param string $name Name of service * @param string $requestedName Unfiltered name of service * * @return object */ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { /** * ExtendedSolrFactoryHelper * * @var ExtendedSolrFactoryHelper $extendedTargetHelper */ $extendedTargetHelper = $serviceLocator->getServiceLocator()->get('Swissbib\\ExtendedSolrFactoryHelper'); $this->defaultNamespace = $extendedTargetHelper->getNamespace($name, $requestedName); return parent::createServiceWithName($serviceLocator, $name, $requestedName); }