Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * @inheritDoc
  */
 public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
 {
     /** @var ExtendedSolrFactoryHelper $extendedTargetHelper */
     $extendedTargetHelper = $serviceLocator->getServiceLocator()->get('Swissbib\\ExtendedSolrFactoryHelper');
     $this->defaultNamespace = $extendedTargetHelper->getNamespace($name, $requestedName);
     return parent::canCreateServiceWithName($serviceLocator, $name, $requestedName);
 }
Exemplo n.º 3
0
 /**
  * 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);
     }
 }