diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index c098ec11aced19af4b2c6099f9c0bb7797a51cc7..c02c8688629ddd669ef53b5f40f3c2c7b7ff3e80 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -742,7 +742,7 @@ $config = array( }, 'similar' => function ($sm) { return new \VuFind\Related\Similar( - $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager') + $sm->getServiceLocator()->get('VuFind\Search') ); }, 'worldcateditions' => function ($sm) { @@ -753,7 +753,7 @@ $config = array( }, 'worldcatsimilar' => function ($sm) { return new \VuFind\Related\WorldCatSimilar( - $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager') + $sm->getServiceLocator()->get('VuFind\Search') ); }, ), diff --git a/module/VuFind/src/VuFind/Related/Similar.php b/module/VuFind/src/VuFind/Related/Similar.php index 6a1192987650a54c723ae5c7a348a5bb6dc2e7f5..a349633dae131a7dbd92b0f34a8bc7edb0ff2833 100644 --- a/module/VuFind/src/VuFind/Related/Similar.php +++ b/module/VuFind/src/VuFind/Related/Similar.php @@ -46,20 +46,20 @@ class Similar implements RelatedInterface protected $results; /** - * Results plugin manager + * Search service * - * @var \VuFind\Search\Results\PluginManager + * @var \VuFindSearch\Service */ - protected $resultsManager; + protected $searchService; /** * Constructor * - * @param \VuFind\Search\Results\PluginManager $results Results plugin manager + * @param \VuFindSearch\Service $results Results plugin manager */ - public function __construct(\VuFind\Search\Results\PluginManager $results) + public function __construct(\VuFindSearch\Service $search) { - $this->resultsManager = $results; + $this->searchService = $search; } /** @@ -74,8 +74,8 @@ class Similar implements RelatedInterface */ public function init($settings, $driver) { - $this->results = $this->resultsManager->get('Solr') - ->getSimilarRecords($driver->getUniqueId()); + $this->results + = $this->searchService->similar('Solr', $driver->getUniqueId()); } /** diff --git a/module/VuFind/src/VuFind/Related/WorldCatSimilar.php b/module/VuFind/src/VuFind/Related/WorldCatSimilar.php index 11fbe3e0efd4d752996800e878b8bf3da490c6fb..8579cd074d53a1ece8e44c2e738395c0f25798a8 100644 --- a/module/VuFind/src/VuFind/Related/WorldCatSimilar.php +++ b/module/VuFind/src/VuFind/Related/WorldCatSimilar.php @@ -91,10 +91,8 @@ class WorldCatSimilar extends Similar } // Perform the search and save results: - $result = $this->resultsManager->get('WorldCat'); - $params = $result->getParams(); - $params->setLimit(5); - $params->setOverrideQuery($query); - $this->results = $result->getResults(); + $queryObj = new \VuFindSearch\Query\Query($query); + $result = $this->searchService->search('WorldCat', $queryObj, 0, 5); + $this->results = $result->getRecords(); } } diff --git a/module/VuFind/src/VuFind/Search/Solr/Results.php b/module/VuFind/src/VuFind/Search/Solr/Results.php index 712af62281cb26c7cbe744f660b5e251f22eb9c8..1e7543d7c1a94bdbeb61a6a50f8cac8deed35b88 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Results.php +++ b/module/VuFind/src/VuFind/Search/Solr/Results.php @@ -408,21 +408,6 @@ class Results extends BaseResults return $list; } - /** - * Method to retrieve records similar to the provided ID. Returns an - * array of record driver objects. - * - * @param string $id Unique identifier of record - * - * @return array - * @tag NEW SEARCH - */ - public function getSimilarRecords($id) - { - $collection = $this->getSearchService()->similar($this->backendId, $id); - return $collection->getRecords(); - } - /** * Get complete facet counts for several index fields *