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 * Search backend search response interface file.
5 *
6 * PHP version 8
7 *
8 * Copyright (C) Villanova University 2010.
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 Search
24 * @package  Service
25 * @author   David Maus <maus@hab.de>
26 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
27 * @link     https://vufind.org/wiki/development
28 */
29
30namespace VuFindSearch\Response;
31
32/**
33 * Interface for backend responses to a search() operation.
34 *
35 * @category Search
36 * @package  Service
37 * @author   David Maus <maus@hab.de>
38 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
39 * @link     https://vufind.org/wiki/development
40 */
41interface RecordCollectionInterface extends \Countable, \Iterator
42{
43    /**
44     * Return total number of records found.
45     *
46     * @return int
47     */
48    public function getTotal();
49
50    /**
51     * Return available facets.
52     *
53     * Returns an associative array with the field name as key. The value is an
54     * associative array of available facets for the field, indexed by facet value.
55     *
56     * @return array
57     */
58    public function getFacets();
59
60    /**
61     * Return records.
62     *
63     * @return array
64     */
65    public function getRecords();
66
67    /**
68     * Return any errors.
69     *
70     * Each error can be a translatable string or an array that the Flashmessages
71     * view helper understands.
72     *
73     * @return array
74     */
75    public function getErrors();
76
77    /**
78     * Return offset in the total search result set.
79     *
80     * @return int
81     */
82    public function getOffset();
83
84    /**
85     * Return first record in collection.
86     *
87     * @return RecordInterface|null
88     */
89    public function first();
90
91    /**
92     * Set the source backend identifier.
93     *
94     * @param string $identifier Backend identifier
95     *
96     * @return void
97     *
98     * @deprecated Use setSourceIdentifiers instead
99     */
100    public function setSourceIdentifier($identifier);
101
102    /**
103     * Set the source backend identifiers.
104     *
105     * @param string $identifier      Record source identifier
106     * @param string $searchBackendId Search backend identifier (if different from
107     * $recordSourceId)
108     *
109     * @return void
110     */
111    public function setSourceIdentifiers($identifier, $searchBackendId = '');
112
113    /**
114     * Return the source backend identifier.
115     *
116     * @return string
117     */
118    public function getSourceIdentifier();
119
120    /**
121     * Add a record to the collection.
122     *
123     * @param RecordInterface $record Record to add
124     *
125     * @return void
126     */
127    public function add(RecordInterface $record);
128}