Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
FacetCacheFactory | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
getResults | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | /** |
4 | * Solr FacetCache Factory. |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2018. |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2, |
12 | * as published by the Free Software Foundation. |
13 | * |
14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | * GNU General Public License for more details. |
18 | * |
19 | * You should have received a copy of the GNU General Public License |
20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 | * |
23 | * @category VuFind |
24 | * @package Search_Solr |
25 | * @author Demian Katz <demian.katz@villanova.edu> |
26 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
27 | * @link https://vufind.org/wiki/development Wiki |
28 | */ |
29 | |
30 | namespace VuFind\Search\Solr; |
31 | |
32 | use Psr\Container\ContainerInterface; |
33 | |
34 | /** |
35 | * Solr FacetCache Factory. |
36 | * |
37 | * @category VuFind |
38 | * @package Search_Solr |
39 | * @author Demian Katz <demian.katz@villanova.edu> |
40 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
41 | * @link https://vufind.org/wiki/development Wiki |
42 | */ |
43 | class FacetCacheFactory extends \VuFind\Search\Base\FacetCacheFactory |
44 | { |
45 | /** |
46 | * Create a results object with hidden filters pre-populated. |
47 | * |
48 | * @param ContainerInterface $container Service manager |
49 | * @param string $name Name of results object to load (based |
50 | * on name of FacetCache service name) |
51 | * |
52 | * @return \VuFind\Search\Base\Results |
53 | */ |
54 | protected function getResults(ContainerInterface $container, $name) |
55 | { |
56 | $filters = $container->get(\VuFind\Search\SearchTabsHelper::class) |
57 | ->getHiddenFilters($name); |
58 | $results = $container->get(\VuFind\Search\Results\PluginManager::class) |
59 | ->get($name); |
60 | $params = $results->getParams(); |
61 | foreach ($filters as $key => $subFilters) { |
62 | foreach ($subFilters as $filter) { |
63 | $params->addHiddenFilter("$key:$filter"); |
64 | } |
65 | } |
66 | return $results; |
67 | } |
68 | } |