|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the TYPO3 CMS project. |
|
7
|
|
|
* |
|
8
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
9
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
10
|
|
|
* of the License, or any later version. |
|
11
|
|
|
* |
|
12
|
|
|
* For the full copyright and license information, please read the |
|
13
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
14
|
|
|
* |
|
15
|
|
|
* The TYPO3 project - inspiring people to share! |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Grouping; |
|
19
|
|
|
|
|
20
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\SearchResult; |
|
21
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Result\SearchResultCollection; |
|
22
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet; |
|
23
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\SearchRequest; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Class GroupItem |
|
27
|
|
|
* |
|
28
|
|
|
* @author Frans Saris <[email protected]> |
|
29
|
|
|
* @author Timo Hund <[email protected]> |
|
30
|
|
|
*/ |
|
31
|
|
|
class GroupItem extends SearchResultSet |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* @var string |
|
35
|
|
|
*/ |
|
36
|
|
|
protected string $groupValue = ''; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var int |
|
40
|
|
|
*/ |
|
41
|
|
|
protected int $allResultCount = 0; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var int |
|
45
|
|
|
*/ |
|
46
|
|
|
protected int $start = 0; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var float |
|
50
|
|
|
*/ |
|
51
|
|
|
protected float $maximumScore = 0.0; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var SearchResultCollection |
|
55
|
|
|
*/ |
|
56
|
|
|
protected SearchResultCollection $searchResults; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var Group |
|
60
|
|
|
*/ |
|
61
|
|
|
protected Group $group; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @param Group $group |
|
65
|
|
|
* @param string $groupValue |
|
66
|
9 |
|
* @param int $numFound |
|
67
|
|
|
* @param int $start |
|
68
|
9 |
|
* @param float $maxScore |
|
69
|
9 |
|
* @param SearchRequest $usedSearchRequest |
|
70
|
9 |
|
*/ |
|
71
|
9 |
|
public function __construct( |
|
72
|
9 |
|
Group $group, |
|
73
|
9 |
|
$groupValue, |
|
74
|
|
|
$numFound, |
|
75
|
|
|
$start, |
|
76
|
|
|
$maxScore, |
|
77
|
|
|
SearchRequest $usedSearchRequest |
|
78
|
|
|
) { |
|
79
|
|
|
parent::__construct(); |
|
80
|
|
|
$this->group = $group; |
|
81
|
2 |
|
$this->groupValue = $groupValue; |
|
82
|
|
|
$this->allResultCount = $numFound; |
|
83
|
2 |
|
$this->start = $start; |
|
84
|
|
|
$this->maximumScore = $maxScore; |
|
85
|
|
|
$this->searchResults = new SearchResultCollection(); |
|
86
|
|
|
$this->usedSearchRequest = $usedSearchRequest; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Get groupValue |
|
91
|
1 |
|
* |
|
92
|
|
|
* @return string |
|
93
|
1 |
|
*/ |
|
94
|
|
|
public function getGroupValue(): string |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->groupValue; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
// /** |
|
100
|
|
|
// * Get numFound |
|
101
|
1 |
|
// * |
|
102
|
|
|
// * @return int |
|
103
|
1 |
|
// */ |
|
104
|
|
|
// public function getAllResultCount(): int |
|
105
|
|
|
// { |
|
106
|
|
|
// return $this->allResultCount; |
|
107
|
|
|
// } |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Get start |
|
111
|
1 |
|
* |
|
112
|
|
|
* @return int |
|
113
|
1 |
|
*/ |
|
114
|
|
|
public function getStart(): int |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->start; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
1 |
|
// /** |
|
120
|
|
|
// * Get maxScore |
|
121
|
1 |
|
// * |
|
122
|
|
|
// * @return float |
|
123
|
|
|
// */ |
|
124
|
|
|
// public function getMaximumScore(): float |
|
125
|
|
|
// { |
|
126
|
|
|
// return $this->maximumScore; |
|
127
|
|
|
// } |
|
128
|
|
|
|
|
129
|
|
|
// /** |
|
130
|
|
|
// * @return SearchResultCollection |
|
131
|
|
|
// */ |
|
132
|
|
|
// public function getSearchResults(): SearchResultCollection |
|
133
|
|
|
// { |
|
134
|
|
|
// return $this->searchResults; |
|
135
|
1 |
|
// } |
|
136
|
|
|
|
|
137
|
1 |
|
// /** |
|
138
|
|
|
// * @param SearchResultCollection $searchResults |
|
139
|
|
|
// */ |
|
140
|
|
|
// public function setSearchResults(SearchResultCollection $searchResults) |
|
141
|
|
|
// { |
|
142
|
|
|
// $this->searchResults = $searchResults; |
|
143
|
2 |
|
// } |
|
144
|
|
|
|
|
145
|
2 |
|
// /** |
|
146
|
|
|
// * @param SearchResult $searchResult |
|
147
|
|
|
// */ |
|
148
|
|
|
// public function addSearchResult(SearchResult $searchResult) |
|
149
|
|
|
// { |
|
150
|
|
|
// $this->searchResults[] = $searchResult; |
|
151
|
|
|
// } |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* @return Group |
|
155
|
|
|
*/ |
|
156
|
|
|
public function getGroup(): Group |
|
157
|
|
|
{ |
|
158
|
|
|
return $this->group; |
|
159
|
|
|
} |
|
160
|
|
|
} |
|
161
|
|
|
|