1
|
|
|
<?php |
2
|
|
|
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Grouping; |
3
|
|
|
|
4
|
|
|
/*************************************************************** |
5
|
|
|
* Copyright notice |
6
|
|
|
* |
7
|
|
|
* (c) 2015-2016 Timo Schmidt <[email protected]> |
8
|
|
|
* All rights reserved |
9
|
|
|
* |
10
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
11
|
|
|
* free software; you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU General Public License as published by |
13
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
14
|
|
|
* (at your option) any later version. |
15
|
|
|
* |
16
|
|
|
* The GNU General Public License can be found at |
17
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
18
|
|
|
* |
19
|
|
|
* This script is distributed in the hope that it will be useful, |
20
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
|
|
|
* GNU General Public License for more details. |
23
|
|
|
* |
24
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
25
|
|
|
***************************************************************/ |
26
|
|
|
|
27
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\SearchResult; |
28
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\SearchResultCollection; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Class Group |
32
|
|
|
* |
33
|
|
|
* @author Frans Saris <[email protected]> |
34
|
|
|
* @author Timo Hund <[email protected]> |
35
|
|
|
* @package ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Grouping |
36
|
|
|
*/ |
37
|
|
|
class Group |
38
|
|
|
{ |
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
protected $groupValue = ''; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var int |
46
|
|
|
*/ |
47
|
|
|
protected $numFound = 0; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var int |
51
|
|
|
*/ |
52
|
|
|
protected $start = 0; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var float |
56
|
|
|
*/ |
57
|
|
|
protected $maxScore = 0; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var SearchResultCollection |
61
|
|
|
*/ |
62
|
|
|
protected $searchResults; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param string $groupValue |
66
|
|
|
* @param int $numFound |
67
|
|
|
* @param int $start |
68
|
|
|
* @param float $maxScore |
69
|
|
|
*/ |
70
|
|
|
public function __construct($groupValue, $numFound, $start, $maxScore) |
71
|
|
|
{ |
72
|
|
|
$this->groupValue = $groupValue; |
73
|
|
|
$this->numFound = $numFound; |
74
|
|
|
$this->start = $start; |
75
|
|
|
$this->maxScore = $maxScore; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Get groupValue |
80
|
|
|
* |
81
|
|
|
* @return string |
82
|
|
|
*/ |
83
|
|
|
public function getGroupValue() |
84
|
|
|
{ |
85
|
|
|
return $this->groupValue; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Get numFound |
90
|
|
|
* |
91
|
|
|
* @return int |
92
|
|
|
*/ |
93
|
|
|
public function getNumFound() |
94
|
|
|
{ |
95
|
|
|
return $this->numFound; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Get start |
100
|
|
|
* |
101
|
|
|
* @return int |
102
|
|
|
*/ |
103
|
|
|
public function getStart() |
104
|
|
|
{ |
105
|
|
|
return $this->start; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Get maxScore |
110
|
|
|
* |
111
|
|
|
* @return float |
112
|
|
|
*/ |
113
|
|
|
public function getMaxScore() |
114
|
|
|
{ |
115
|
|
|
return $this->maxScore; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return SearchResultCollection |
120
|
|
|
*/ |
121
|
|
|
public function getSearchResults(): SearchResultCollection |
122
|
|
|
{ |
123
|
|
|
return $this->searchResults; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param SearchResultCollection $searchResults |
128
|
|
|
*/ |
129
|
|
|
public function setSearchResults(SearchResultCollection $searchResults) |
130
|
|
|
{ |
131
|
|
|
$this->searchResults = $searchResults; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @param SearchResult $searchResult |
136
|
|
|
*/ |
137
|
|
|
public function addSearchResult(SearchResult $searchResult) |
138
|
|
|
{ |
139
|
|
|
$this->searchResults[] = $searchResult; |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
|