コード例 #1
0
 /**
  * Test attaching to and detaching from shared event manager.
  *
  * @return void
  */
 public function testAttachDetachShared()
 {
     $registry = $this->getMockForAbstractClass('Zend\\ServiceManager\\ServiceLocatorInterface');
     $events = new SharedEventManager();
     $manager = new BackendManager($registry);
     $manager->attachShared($events);
     $listeners = $this->getProperty($manager, 'listeners');
     $this->assertTrue($listeners->offsetExists($events));
     $manager->detachShared($events);
     $this->assertFalse($listeners->offsetExists($events));
 }
コード例 #2
0
ファイル: Writer.php プロジェクト: bbeckman/NDL-VuFind2
 /**
  * Get the connector for a specified backend.
  *
  * @param string $backend Backend ID
  *
  * @return Connector
  */
 protected function getConnector($backend)
 {
     $connector = $this->backendManager->get($backend)->getConnector();
     if (!$connector instanceof Connector) {
         throw new \Exception('Unexpected connector: ' . get_class($connector));
     }
     return $connector;
 }
コード例 #3
0
ファイル: Generator.php プロジェクト: grharry/vufind
 /**
  * Generate the sitemaps based on settings established by the constructor.
  *
  * @return void
  */
 public function generate()
 {
     // Initialize variable
     $currentPage = 1;
     // Loop through all backends
     foreach ($this->backendSettings as $current) {
         $backend = $this->backendManager->get($current['id']);
         if (!$backend instanceof Backend) {
             throw new \Exception('Unsupported backend: ' . get_class($backend));
         }
         $recordUrl = $this->baseUrl . $current['url'];
         $currentPage = $this->generateForBackend($backend, $recordUrl, $currentPage);
     }
     // Set-up Sitemap Index
     $this->buildIndex($currentPage - 1);
 }
コード例 #4
0
ファイル: SwitchQuery.php プロジェクト: grharry/vufind
 /**
  * Extract a Lucene syntax helper from the search backend, if possible.
  *
  * @return bool|\VuFindSearch\Backend\Solr\LuceneSyntaxHelper
  */
 protected function getLuceneHelper()
 {
     $backend = $this->backendManager->get($this->backend);
     $qb = is_callable([$backend, 'getQueryBuilder']) ? $backend->getQueryBuilder() : false;
     return $qb && is_callable([$qb, 'getLuceneHelper']) ? $qb->getLuceneHelper() : false;
 }
コード例 #5
0
ファイル: Solr.php プロジェクト: grharry/vufind
 /**
  * Constructor
  *
  * @param \Zend\Config\Config           $config  config
  * @param \VuFind\Search\BackendManager $backend backend manager
  */
 public function __construct($config, $backend)
 {
     $this->config = $config;
     $this->solr = $backend->getConnector();
 }
コード例 #6
0
ファイル: MapSelection.php プロジェクト: bbeckman/NDL-VuFind2
 /**
  * Get geo field values for all search results
  *
  * @return array
  */
 public function getSearchResultCoordinates()
 {
     $result = [];
     $params = $this->searchFilters;
     // Check to makes sure we have a geographic search
     if (strpos($params->get('fq')[0], $this->geoField) !== false) {
         $params->mergeWith($this->queryBuilder->build($this->searchQuery));
         $params->set('fl', 'id, ' . $this->geoField . ', title');
         $params->set('wt', 'json');
         $params->set('rows', '10000000');
         // set to return all results
         $response = json_decode($this->solrConnector->search($params));
         foreach ($response->response->docs as $current) {
             $result[] = [$current->id, $current->{$this->geoField}, $current->title];
         }
     }
     return $result;
 }