Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | /** |
4 | * Primo Central connector interface. |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2010. |
9 | * Copyright (C) The National Library of Finland 2023. |
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, write to the Free Software |
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
23 | * |
24 | * @category VuFind |
25 | * @package Search |
26 | * @author Spencer Lamm <slamm1@swarthmore.edu> |
27 | * @author Anna Headley <aheadle1@swarthmore.edu> |
28 | * @author Chelsea Lobdell <clobdel1@swarthmore.edu> |
29 | * @author Demian Katz <demian.katz@villanova.edu> |
30 | * @author Ere Maijala <ere.maijala@helsinki.fi> |
31 | * @author Oliver Goldschmidt <o.goldschmidt@tuhh.de> |
32 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
33 | * @link https://vufind.org |
34 | */ |
35 | |
36 | namespace VuFindSearch\Backend\Primo; |
37 | |
38 | /** |
39 | * Primo Central connector interface. |
40 | * |
41 | * @category VuFind |
42 | * @package Search |
43 | * @author Spencer Lamm <slamm1@swarthmore.edu> |
44 | * @author Anna Headley <aheadle1@swarthmore.edu> |
45 | * @author Chelsea Lobdell <clobdel1@swarthmore.edu> |
46 | * @author Demian Katz <demian.katz@villanova.edu> |
47 | * @author Ere Maijala <ere.maijala@helsinki.fi> |
48 | * @author Oliver Goldschmidt <o.goldschmidt@tuhh.de> |
49 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
50 | * @link https://vufind.org |
51 | */ |
52 | interface ConnectorInterface |
53 | { |
54 | /** |
55 | * Execute a search. Adds all the querystring parameters into |
56 | * $this->client and returns the parsed response |
57 | * |
58 | * @param string $institution Institution |
59 | * @param array $terms Associative array: |
60 | * index string: primo index to search (default "any") |
61 | * lookfor string: actual search terms |
62 | * @param array $params Associative array of optional arguments: |
63 | * phrase bool: true if it's a quoted phrase (default false) |
64 | * onCampus bool: (default true) |
65 | * didyoumean bool: (default false) |
66 | * filterList array: (field, value) pairs to filter results (def null) |
67 | * pageNumber string: index of first record (default 1) |
68 | * limit string: number of records to return (default 20) |
69 | * sort string: value to be used by for sorting (default null) |
70 | * highlight bool: whether to highlight search term matches in records |
71 | * highlightStart string: Prefix for a highlighted term |
72 | * highlightEnd string: Suffix for a Highlighted term |
73 | * Anything in $params not listed here will be ignored. |
74 | * |
75 | * Note: some input parameters accepted by Primo are not implemented here: |
76 | * - dym (did you mean) |
77 | * - more (get more) |
78 | * - lang (specify input language so engine can do lang. recognition) |
79 | * - displayField (has to do with highlighting somehow) |
80 | * |
81 | * @throws \Exception |
82 | * @return array An array of query results |
83 | * |
84 | * @link http://www.exlibrisgroup.org/display/PrimoOI/Brief+Search |
85 | */ |
86 | public function query($institution, $terms, $params = null); |
87 | |
88 | /** |
89 | * Retrieves a document specified by the ID. |
90 | * |
91 | * @param string $recordId The document to retrieve from the Primo API |
92 | * @param ?string $inst_code Institution code (optional) |
93 | * @param bool $onCampus Whether the user is on campus |
94 | * |
95 | * @throws \Exception |
96 | * @return array An array of query results |
97 | */ |
98 | public function getRecord(string $recordId, $inst_code = null, $onCampus = false); |
99 | |
100 | /** |
101 | * Get the institution code based on user IP. If user is coming from |
102 | * off campus return |
103 | * |
104 | * @return string |
105 | */ |
106 | public function getInstitutionCode(); |
107 | } |