Skip to content

Commit 56e59df

Browse files
Stefan WeilUBMA Sysadmins
authored andcommitted
Add function getGVIRecord
1 parent d00e5fe commit 56e59df

File tree

3 files changed

+82
-2
lines changed

3 files changed

+82
-2
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
3+
/**
4+
* Default model for GVI records -- used when a more specific model based on
5+
* the record_format field cannot be found.
6+
*
7+
* PHP version 8
8+
*
9+
* Copyright (C) Villanova University 2010.
10+
*
11+
* This program is free software; you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License version 2,
13+
* as published by the Free Software Foundation.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU General Public License
21+
* along with this program; if not, see
22+
* <https://www.gnu.org/licenses/>.
23+
*
24+
* @category VuFind
25+
* @package RecordDrivers
26+
* @author Demian Katz <demian.katz@villanova.edu>
27+
* @author Samuli Sillanpää <samuli.sillanpaa@helsinki.fi>
28+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
29+
* @link https://vufind.org/wiki/development:plugins:record_drivers Wiki
30+
*/
31+
32+
namespace VuFind\RecordDriver;
33+
34+
/**
35+
* Default model for GVI records -- used when a more specific model based on
36+
* the record_format field cannot be found.
37+
*
38+
* This should be used as the base class for all Solr-based record models.
39+
*
40+
* @category VuFind
41+
* @package RecordDrivers
42+
* @author Demian Katz <demian.katz@villanova.edu>
43+
* @author Samuli Sillanpää <samuli.sillanpaa@helsinki.fi>
44+
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
45+
* @link https://vufind.org/wiki/development:plugins:record_drivers Wiki
46+
*
47+
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
48+
*/
49+
class GVIDefault extends SolrDefault
50+
{
51+
/**
52+
* Used for identifying search backends
53+
*
54+
* @var string
55+
*/
56+
protected $sourceIdentifier = 'GVI';
57+
58+
/**
59+
* Get the Hierarchy Type (false if none)
60+
*
61+
* @return string|bool
62+
*/
63+
public function getHierarchyType()
64+
{
65+
return parent::getHierarchyType() ? 'gvi' : false;
66+
}
67+
}

module/VuFind/src/VuFind/RecordDriver/PluginManager.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager
9696
EDS::class => NameBasedConfigFactory::class,
9797
EIT::class => NameBasedConfigFactory::class,
9898
EPF::class => NameBasedConfigFactory::class,
99+
GVIDefault::class => GVIDefaultFactory::class,
99100
LibGuides::class => InvokableFactory::class,
100101
LibGuidesAZ::class => InvokableFactory::class,
101102
Missing::class => AbstractBaseFactory::class,
@@ -164,6 +165,19 @@ protected function getExpectedInterface()
164165
return AbstractBase::class;
165166
}
166167

168+
/**
169+
* Convenience method to retrieve a populated Search2 record driver.
170+
*
171+
* @param array $data Raw Solr data
172+
* @param string $defaultKeySuffix Default key suffix
173+
*
174+
* @return AbstractBase
175+
*/
176+
public function getGVIRecord($data, $defaultKeySuffix = 'Default')
177+
{
178+
return $this->getSolrRecord($data, 'GVI', $defaultKeySuffix);
179+
}
180+
167181
/**
168182
* Convenience method to retrieve a populated Solr record driver.
169183
*

module/VuFind/src/VuFind/Search/Factory/GVIBackendFactory.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public function __construct()
6060
protected function getCreateRecordCallback(): ?callable
6161
{
6262
$manager = $this->getService(\VuFind\RecordDriver\PluginManager::class);
63-
//return [$manager, 'getGVIRecord'];
64-
return [$manager, 'getSearch2Record'];
63+
return [$manager, 'getGVIRecord'];
6564
}
6665
}

0 commit comments

Comments
 (0)