Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
Results | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
performSearch | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
6 | |||
getFacetList | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | /** |
4 | * EPF API Results |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2022. |
9 | * Copyright (C) EBSCO Industries 2013 |
10 | * Copyright (C) Villanova University 2023 |
11 | * |
12 | * This program is free software; you can redistribute it and/or modify |
13 | * it under the terms of the GNU General Public License version 2, |
14 | * as published by the Free Software Foundation. |
15 | * |
16 | * This program is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | * GNU General Public License for more details. |
20 | * |
21 | * You should have received a copy of the GNU General Public License |
22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
24 | * |
25 | * @category VuFind |
26 | * @package EBSCO |
27 | * @author Michelle Milton <mmilton@epnet.com> |
28 | * @author Sudharma Kellampalli <skellamp@villanova.edu> |
29 | * @author Maccabee Levine <msl321@lehigh.edu> |
30 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
31 | * @link https://vufind.org Main Page |
32 | */ |
33 | |
34 | namespace VuFind\Search\EPF; |
35 | |
36 | use VuFindSearch\Command\SearchCommand; |
37 | |
38 | /** |
39 | * EPF API Results |
40 | * |
41 | * @category VuFind |
42 | * @package EBSCO |
43 | * @author Michelle Milton <mmilton@epnet.com> |
44 | * @author Maccabee Levine <msl321@lehigh.edu> |
45 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
46 | * @link https://vufind.org Main Page |
47 | */ |
48 | class Results extends \VuFind\Search\Base\Results |
49 | { |
50 | /** |
51 | * Search backend identifier. |
52 | * |
53 | * @var string |
54 | */ |
55 | protected $backendId = 'EPF'; |
56 | |
57 | /** |
58 | * Facet list |
59 | * |
60 | * @var array |
61 | */ |
62 | protected $responseFacets; |
63 | |
64 | /** |
65 | * Support method for performAndProcessSearch -- perform a search based on the |
66 | * parameters passed to the object. |
67 | * |
68 | * @return void |
69 | */ |
70 | protected function performSearch() |
71 | { |
72 | $query = $this->getParams()->getQuery(); |
73 | $limit = $this->getParams()->getLimit(); |
74 | $offset = $this->getStartRecord() - 1; |
75 | $params = $this->getParams()->getBackendParameters(); |
76 | $command = new SearchCommand( |
77 | $this->backendId, |
78 | $query, |
79 | $offset, |
80 | $limit, |
81 | $params |
82 | ); |
83 | $collection = $this->getSearchService()->invoke($command) |
84 | ->getResult(); |
85 | if (null != $collection) { |
86 | $this->responseFacets = $collection->getFacets(); |
87 | $this->resultTotal = $collection->getTotal(); |
88 | |
89 | // Construct record drivers for all the items in the response: |
90 | $this->results = $collection->getRecords(); |
91 | } |
92 | } |
93 | |
94 | /** |
95 | * Returns the stored list of facets for the last search |
96 | * |
97 | * @param array $filter Array of field => on-screen description listing |
98 | * all of the desired facet fields; set to null to get all configured values. |
99 | * |
100 | * @return array Facets data arrays |
101 | */ |
102 | public function getFacetList($filter = null) |
103 | { |
104 | if (null === $this->responseFacets) { |
105 | $this->performAndProcessSearch(); |
106 | } |
107 | return $this->buildFacetList($this->responseFacets, $filter); |
108 | } |
109 | } |