1 | <?php |
||
43 | class SearchResultSet |
||
44 | { |
||
45 | |||
46 | /** |
||
47 | * @var Query |
||
48 | */ |
||
49 | protected $usedQuery = null; |
||
50 | |||
51 | /** |
||
52 | * @var SearchRequest |
||
53 | */ |
||
54 | protected $usedSearchRequest = null; |
||
55 | |||
56 | /** |
||
57 | * @var Search |
||
58 | */ |
||
59 | protected $usedSearch; |
||
60 | |||
61 | /** |
||
62 | * @var \Apache_Solr_Response |
||
63 | */ |
||
64 | protected $response = null; |
||
65 | |||
66 | /** |
||
67 | * @var int |
||
68 | */ |
||
69 | protected $usedPage = 0; |
||
70 | |||
71 | /** |
||
72 | * @var int |
||
73 | */ |
||
74 | protected $usedResultsPerPage = 0; |
||
75 | |||
76 | /** |
||
77 | * @var array |
||
78 | */ |
||
79 | protected $usedAdditionalFilters = []; |
||
80 | |||
81 | /** |
||
82 | * @var array |
||
83 | */ |
||
84 | protected $searchResults = []; |
||
85 | |||
86 | /** |
||
87 | * @var int |
||
88 | */ |
||
89 | protected $allResultCount = 0; |
||
90 | |||
91 | /** |
||
92 | * @var Suggestion[] |
||
93 | */ |
||
94 | protected $spellCheckingSuggestions = []; |
||
95 | |||
96 | /** |
||
97 | * @var FacetCollection |
||
98 | */ |
||
99 | protected $facets = null; |
||
100 | |||
101 | /** |
||
102 | * @var SortingCollection |
||
103 | */ |
||
104 | protected $sortings = null; |
||
105 | |||
106 | /** |
||
107 | * @var bool |
||
108 | */ |
||
109 | protected $isAutoCorrected = false; |
||
110 | |||
111 | /** |
||
112 | * @var string |
||
113 | */ |
||
114 | protected $initialQueryString = ''; |
||
115 | |||
116 | /** |
||
117 | * @var string |
||
118 | */ |
||
119 | protected $correctedQueryString = ''; |
||
120 | |||
121 | /** |
||
122 | * @return \ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet |
||
|
|||
123 | */ |
||
124 | 86 | public function __construct() |
|
125 | { |
||
126 | 86 | $this->facets = new FacetCollection(); |
|
127 | 86 | $this->sortings = new SortingCollection(); |
|
128 | 86 | } |
|
129 | |||
130 | /** |
||
131 | * @param int $allResultCount |
||
132 | */ |
||
133 | 60 | public function setAllResultCount($allResultCount) |
|
134 | { |
||
135 | 60 | $this->allResultCount = $allResultCount; |
|
136 | 60 | } |
|
137 | |||
138 | /** |
||
139 | * @return int |
||
140 | */ |
||
141 | 27 | public function getAllResultCount() |
|
145 | |||
146 | /** |
||
147 | * @param Suggestion $suggestion |
||
148 | */ |
||
149 | 5 | public function addSpellCheckingSuggestion(Suggestion $suggestion) |
|
150 | { |
||
151 | 5 | $this->spellCheckingSuggestions[$suggestion->getSuggestion()] = $suggestion; |
|
152 | 5 | } |
|
153 | |||
154 | /** |
||
155 | * @return bool |
||
156 | */ |
||
157 | 30 | public function getHasSpellCheckingSuggestions() |
|
161 | |||
162 | /** |
||
163 | * @param \ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Spellchecking\Suggestion[] $spellCheckingSuggestions |
||
164 | */ |
||
165 | public function setSpellCheckingSuggestions($spellCheckingSuggestions) |
||
166 | { |
||
167 | $this->spellCheckingSuggestions = $spellCheckingSuggestions; |
||
168 | } |
||
169 | |||
170 | /** |
||
171 | * @return \ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Spellchecking\Suggestion[] |
||
172 | */ |
||
173 | 4 | public function getSpellCheckingSuggestions() |
|
177 | |||
178 | /** |
||
179 | * @return FacetCollection |
||
180 | */ |
||
181 | 59 | public function getFacets() |
|
185 | |||
186 | /** |
||
187 | * @param AbstractFacet $facet |
||
188 | */ |
||
189 | 55 | public function addFacet(AbstractFacet $facet) |
|
190 | { |
||
191 | 55 | $this->facets->addFacet($facet); |
|
192 | 55 | } |
|
193 | |||
194 | /** |
||
195 | * @param Sorting $sorting |
||
196 | */ |
||
197 | 29 | public function addSorting(Sorting $sorting) |
|
198 | { |
||
199 | 29 | $this->sortings->addSorting($sorting); |
|
200 | 29 | } |
|
201 | |||
202 | /** |
||
203 | * @return SortingCollection |
||
204 | */ |
||
205 | 29 | public function getSortings() |
|
209 | |||
210 | /** |
||
211 | * @param \Apache_Solr_Response $response |
||
212 | */ |
||
213 | 78 | public function setResponse($response) |
|
214 | { |
||
215 | 78 | $this->response = $response; |
|
216 | 78 | } |
|
217 | |||
218 | /** |
||
219 | * @return \Apache_Solr_Response |
||
220 | */ |
||
221 | 78 | public function getResponse() |
|
222 | { |
||
223 | 78 | return $this->response; |
|
224 | } |
||
225 | |||
226 | /** |
||
227 | * @param array $usedAdditionalFilters |
||
228 | */ |
||
229 | 38 | public function setUsedAdditionalFilters($usedAdditionalFilters) |
|
230 | { |
||
231 | 38 | $this->usedAdditionalFilters = $usedAdditionalFilters; |
|
232 | 38 | } |
|
233 | |||
234 | /** |
||
235 | * @return array |
||
236 | */ |
||
237 | public function getUsedAdditionalFilters() |
||
238 | { |
||
239 | return $this->usedAdditionalFilters; |
||
240 | } |
||
241 | |||
242 | /** |
||
243 | * @param \ApacheSolrForTypo3\Solr\Query $usedQuery |
||
244 | */ |
||
245 | 38 | public function setUsedQuery($usedQuery) |
|
246 | { |
||
247 | 38 | $this->usedQuery = $usedQuery; |
|
248 | 38 | } |
|
249 | |||
250 | /** |
||
251 | * Retrieves the query object that has been used to build this result set. |
||
252 | * |
||
253 | * @return \ApacheSolrForTypo3\Solr\Query |
||
254 | */ |
||
255 | 30 | public function getUsedQuery() |
|
256 | { |
||
257 | 30 | return $this->usedQuery; |
|
258 | } |
||
259 | |||
260 | /** |
||
261 | * @param int $page |
||
262 | */ |
||
263 | 38 | public function setUsedPage($page) |
|
264 | { |
||
265 | 38 | $this->usedPage = $page; |
|
266 | 38 | } |
|
267 | |||
268 | /** |
||
269 | * Retrieve the page argument that has been used to build this SearchResultSet. |
||
270 | * |
||
271 | * @return int |
||
272 | */ |
||
273 | 27 | public function getUsedPage() |
|
277 | |||
278 | /** |
||
279 | * @return int |
||
280 | */ |
||
281 | public function getResultsPerPage() |
||
282 | { |
||
283 | return $this->usedQuery->getResultsPerPage(); |
||
284 | } |
||
285 | |||
286 | /** |
||
287 | * @param \ApacheSolrForTypo3\Solr\Domain\Search\SearchRequest $usedSearchRequest |
||
288 | */ |
||
289 | 81 | public function setUsedSearchRequest($usedSearchRequest) |
|
290 | { |
||
291 | 81 | $this->usedSearchRequest = $usedSearchRequest; |
|
292 | 81 | } |
|
293 | |||
294 | /** |
||
295 | * Retrieves the SearchRequest that has been used to build this SearchResultSet. |
||
296 | * |
||
297 | * @return \ApacheSolrForTypo3\Solr\Domain\Search\SearchRequest |
||
298 | */ |
||
299 | 81 | public function getUsedSearchRequest() |
|
303 | |||
304 | /** |
||
305 | * @param \ApacheSolrForTypo3\Solr\Search $usedSearch |
||
306 | */ |
||
307 | 38 | public function setUsedSearch($usedSearch) |
|
308 | { |
||
309 | 38 | $this->usedSearch = $usedSearch; |
|
310 | 38 | } |
|
311 | |||
312 | /** |
||
313 | * @return \ApacheSolrForTypo3\Solr\Search |
||
314 | */ |
||
315 | 29 | public function getUsedSearch() |
|
319 | |||
320 | /** |
||
321 | * @param int $usedResultsPerPage |
||
322 | */ |
||
323 | 38 | public function setUsedResultsPerPage($usedResultsPerPage) |
|
324 | { |
||
325 | 38 | $this->usedResultsPerPage = $usedResultsPerPage; |
|
326 | 38 | } |
|
327 | |||
328 | /** |
||
329 | * @return int |
||
330 | */ |
||
331 | 22 | public function getUsedResultsPerPage() |
|
332 | { |
||
333 | 22 | return $this->usedResultsPerPage; |
|
334 | } |
||
335 | |||
336 | /** |
||
337 | * @return array |
||
338 | */ |
||
339 | 4 | public function getSearchResults() |
|
343 | |||
344 | /** |
||
345 | * @param array $searchResults |
||
346 | */ |
||
347 | public function setSearchResults($searchResults) |
||
348 | { |
||
349 | $this->searchResults = $searchResults; |
||
350 | } |
||
351 | |||
352 | /** |
||
353 | * @param SearchResult $searchResult |
||
354 | */ |
||
355 | 27 | public function addSearchResult(SearchResult $searchResult) |
|
356 | { |
||
357 | 27 | $this->searchResults[] = $searchResult; |
|
358 | 27 | } |
|
359 | |||
360 | /** |
||
361 | * @return boolean |
||
362 | */ |
||
363 | 26 | public function getIsAutoCorrected() |
|
367 | |||
368 | /** |
||
369 | * @param boolean $wasAutoCorrected |
||
370 | */ |
||
371 | 1 | public function setIsAutoCorrected($wasAutoCorrected) |
|
375 | |||
376 | /** |
||
377 | * @return string |
||
378 | */ |
||
379 | 1 | public function getInitialQueryString() |
|
383 | |||
384 | /** |
||
385 | * @param string $initialQueryString |
||
386 | */ |
||
387 | 1 | public function setInitialQueryString($initialQueryString) |
|
391 | |||
392 | /** |
||
393 | * @return string |
||
394 | */ |
||
395 | 1 | public function getCorrectedQueryString() |
|
399 | |||
400 | /** |
||
401 | * @param string $correctedQueryString |
||
402 | */ |
||
403 | 1 | public function setCorrectedQueryString($correctedQueryString) |
|
407 | } |
||
408 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.