-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
424 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
module/FacetPrefix/src/FacetPrefix/Search/Primo/Params.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
/** | ||
* Params Extension for FacetPrefix Module | ||
* | ||
* PHP version 5 | ||
* | ||
* Copyright (C) Staats- und Universitätsbibliothek 2017. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
* | ||
* @category VuFind2 | ||
* @package Search | ||
* @author Hajo Seng <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://github.com/subhh/beluga | ||
*/ | ||
namespace FacetPrefix\Search\Primo; | ||
|
||
use Libraries\Libraries; | ||
use VuFindSearch\ParamBag; | ||
|
||
class Params extends \Libraries\Search\Primo\Params | ||
{ | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \VuFind\Search\Base\Options $options Options to use | ||
* @param \VuFind\Config\PluginManager $configLoader Config loader | ||
*/ | ||
public function __construct($options, \VuFind\Config\PluginManager $configLoader, | ||
\VuFind\Search\Memory $searchMemory | ||
) { | ||
parent::__construct($options, $configLoader); | ||
} | ||
|
||
/** | ||
* Return current facet configurations | ||
* | ||
* @return array $facetSet | ||
*/ | ||
public function getFacetSettings() | ||
{ | ||
$facetSet = parent::getFacetSettings(); | ||
|
||
$facetConfig = $this->configLoader->get('facets'); | ||
if (isset($facetConfig->FacetPrefix)) { | ||
foreach ($facetConfig->FacetPrefix as $facet => $prefix) { | ||
$facetSet["f.{$facet}.facet.prefix"] = $prefix; | ||
} | ||
} | ||
|
||
return $facetSet; | ||
} | ||
} | ||
|
103 changes: 103 additions & 0 deletions
103
module/FacetPrefix/src/FacetPrefix/Search/Results/PluginManager.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?php | ||
/** | ||
* Search results plugin manager | ||
* | ||
* PHP version 7 | ||
* | ||
* Copyright (C) Villanova University 2010. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
* | ||
* @category VuFind | ||
* @package Search | ||
* @author Demian Katz <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org/wiki/development:plugins:record_drivers Wiki | ||
*/ | ||
namespace FacetPrefix\Search\Results; | ||
|
||
/** | ||
* Search results plugin manager | ||
* | ||
* @category VuFind | ||
* @package Search | ||
* @author Demian Katz <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org/wiki/development:plugins:record_drivers Wiki | ||
*/ | ||
class PluginManager extends \Libraries\Search\Results\PluginManager | ||
{ | ||
/** | ||
* Default plugin aliases. | ||
* | ||
* @var array | ||
*/ | ||
protected $aliases = [ | ||
'browzine' => 'VuFind\Search\BrowZine\Results', | ||
'combined' => 'VuFind\Search\Combined\Results', | ||
'eds' => 'VuFind\Search\EDS\Results', | ||
'eit' => 'VuFind\Search\EIT\Results', | ||
'emptyset' => 'VuFind\Search\EmptySet\Results', | ||
'favorites' => 'VuFind\Search\Favorites\Results', | ||
'libguides' => 'VuFind\Search\LibGuides\Results', | ||
'mixedlist' => 'VuFind\Search\MixedList\Results', | ||
'pazpar2' => 'VuFind\Search\Pazpar2\Results', | ||
'primo' => 'VuFind\Search\Primo\Results', | ||
'search2' => 'VuFind\Search\Search2\Results', | ||
'solr' => 'VuFind\Search\Solr\Results', | ||
'solrauth' => 'VuFind\Search\SolrAuth\Results', | ||
'solrauthor' => 'VuFind\Search\SolrAuthor\Results', | ||
'solrauthorfacets' => 'VuFind\Search\SolrAuthorFacets\Results', | ||
'solrcollection' => 'VuFind\Search\SolrCollection\Results', | ||
'solrreserves' => 'VuFind\Search\SolrReserves\Results', | ||
'solrweb' => 'VuFind\Search\SolrWeb\Results', | ||
'summon' => 'VuFind\Search\Summon\Results', | ||
'tags' => 'VuFind\Search\Tags\Results', | ||
'worldcat' => 'VuFind\Search\WorldCat\Results', | ||
]; | ||
|
||
/** | ||
* Default plugin factories. | ||
* | ||
* @var array | ||
*/ | ||
protected $factories = [ | ||
'VuFind\Search\BrowZine\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\Combined\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\EDS\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\EIT\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\EmptySet\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\Favorites\Results' => | ||
'VuFind\Search\Favorites\ResultsFactory', | ||
'VuFind\Search\LibGuides\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\MixedList\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\Pazpar2\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\Primo\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\Search2\Results' => 'FacetPrefix\Search\Search2\ResultsFactory', | ||
'VuFind\Search\Solr\Results' => 'FacetPrefix\Search\Solr\ResultsFactory', | ||
'VuFind\Search\SolrAuth\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\SolrAuthor\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\SolrAuthorFacets\Results' => | ||
'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\SolrCollection\Results' => | ||
'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\SolrReserves\Results' => | ||
'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\SolrWeb\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\Summon\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
'VuFind\Search\Tags\Results' => 'VuFind\Search\Tags\ResultsFactory', | ||
'VuFind\Search\WorldCat\Results' => 'VuFind\Search\Results\ResultsFactory', | ||
]; | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
module/FacetPrefix/src/FacetPrefix/Search/Results/ResultsFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
/** | ||
* Generic factory for search results objects. | ||
* | ||
* PHP version 7 | ||
* | ||
* Copyright (C) Villanova University 2018. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
* | ||
* @category VuFind | ||
* @package Search | ||
* @author Demian Katz <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org/wiki/development Wiki | ||
*/ | ||
namespace FacetPrefix\Search\Results; | ||
|
||
use Interop\Container\ContainerInterface; | ||
use Zend\ServiceManager\Factory\FactoryInterface; | ||
|
||
/** | ||
* Generic factory for search results objects. | ||
* | ||
* @category VuFind | ||
* @package Search | ||
* @author Demian Katz <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org/wiki/development Wiki | ||
*/ | ||
class ResultsFactory implements FactoryInterface | ||
{ | ||
/** | ||
* Create an object | ||
* | ||
* @param ContainerInterface $container Service manager | ||
* @param string $requestedName Service being created | ||
* @param null|array $options Extra options (optional) | ||
* | ||
* @return object | ||
* | ||
* @throws ServiceNotFoundException if unable to resolve the service. | ||
* @throws ServiceNotCreatedException if an exception is raised when | ||
* creating a service. | ||
* @throws ContainerException if any other error occurs | ||
*/ | ||
public function __invoke(ContainerInterface $container, $requestedName, | ||
array $options = null | ||
) { | ||
// Replace trailing "Results" with "Params" to get the params service: | ||
$paramsService = preg_replace('/Results$/', 'Params', $requestedName); | ||
$paramsService = preg_replace('/^VuFind/', 'FacetPrefix', $paramsService); | ||
$params = $container->get('FacetPrefix\Search\Params\PluginManager') | ||
->get($paramsService); | ||
$searchService = $container->get('VuFindSearch\Service'); | ||
$recordLoader = $container->get('VuFind\Record\Loader'); | ||
return new $requestedName( | ||
$params, $searchService, $recordLoader, ...($options ?: []) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.