From 83aa500a5b932fb6540967fc4f61e5b68dea24d3 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 7 Sep 2012 11:07:31 -0400 Subject: [PATCH] Set up record loader to use Search Manager for class name determination; added alias to account for legacy VuFind source value in database. --- module/VuFind/config/module.config.php | 3 +++ module/VuFind/src/VuFind/Record/Loader.php | 11 ++--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 517aac13ea2..89e6be48e0a 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -192,6 +192,9 @@ $config = array( 'namespaces_by_id' => array( ), 'aliases' => array( + // Alias to account for "source" field in resource table, + // which uses "VuFind" for records from Solr index. + 'VuFind' => 'Solr' ), ), 'service_manager' => array( diff --git a/module/VuFind/src/VuFind/Record/Loader.php b/module/VuFind/src/VuFind/Record/Loader.php index bdf6468dcbf..a281fda23e5 100644 --- a/module/VuFind/src/VuFind/Record/Loader.php +++ b/module/VuFind/src/VuFind/Record/Loader.php @@ -66,15 +66,8 @@ class Loader implements ServiceLocatorAwareInterface */ protected function getClassForSource($source) { - // Special case -- the VuFind record source actually maps to Solr classes; - // this is a legacy issue related to values inserted into the database by - // VuFind 1.x: - if ($source == 'VuFind') { - $source = 'Solr'; - } - - // Use the appropriate Search class to load the requested record: - $class = 'VuFind\Search\\' . $source . '\Results'; + $sm = $this->getServiceLocator()->get('SearchManager'); + $class = $sm->setSearchClassId($source)->getResultsClass(); // Throw an error if we can't find a loader class: if (!class_exists($class)) { -- GitLab