1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kitodo\Dlf\Common; |
4
|
|
|
|
5
|
|
|
use TYPO3\CMS\Extbase\Persistence\QueryInterface; |
6
|
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface; |
7
|
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface; |
8
|
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Targeted towards being used in ``PaginateController`` (``<f:widget.paginate>``). |
12
|
|
|
*/ |
13
|
|
|
class SolrSearchQuery implements QueryInterface |
14
|
|
|
{ |
15
|
|
|
public function __construct($solrSearch) |
16
|
|
|
{ |
17
|
|
|
$this->solrSearch = $solrSearch; |
|
|
|
|
18
|
|
|
|
19
|
|
|
$this->offset = 0; |
|
|
|
|
20
|
|
|
$this->limit = count($solrSearch); |
|
|
|
|
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function getSource() {} |
24
|
|
|
|
25
|
|
|
public function execute($returnRawQueryResult = false) |
26
|
|
|
{ |
27
|
|
|
$this->solrSearch->submit($this->offset, $this->limit); |
28
|
|
|
|
29
|
|
|
// solrSearch now only contains the results in range, indexed in [0, n) |
30
|
|
|
$result = []; |
31
|
|
|
$limit = min($this->limit, $this->solrSearch->getNumLoadedDocuments()); |
32
|
|
|
for ($i = 0; $i < $limit; $i++) { |
33
|
|
|
$result[] = $this->solrSearch[$i]; |
34
|
|
|
} |
35
|
|
|
return $result; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function setOrderings(array $orderings) {} |
39
|
|
|
|
40
|
|
|
public function setLimit($limit) |
41
|
|
|
{ |
42
|
|
|
$this->limit = $limit; |
|
|
|
|
43
|
|
|
return $this; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function setOffset($offset) |
47
|
|
|
{ |
48
|
|
|
$this->offset = $offset; |
|
|
|
|
49
|
|
|
return $this; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function matching($constraint) {} |
53
|
|
|
public function logicalAnd($constraint1) {} |
54
|
|
|
public function logicalOr($constraint1) {} |
55
|
|
|
public function logicalNot(ConstraintInterface $constraint) {} |
56
|
|
|
public function equals($propertyName, $operand, $caseSensitive = true) {} |
57
|
|
|
public function like($propertyName, $operand) {} |
58
|
|
|
public function contains($propertyName, $operand) {} |
59
|
|
|
public function in($propertyName, $operand) {} |
60
|
|
|
public function lessThan($propertyName, $operand) {} |
61
|
|
|
public function lessThanOrEqual($propertyName, $operand) {} |
62
|
|
|
public function greaterThan($propertyName, $operand) {} |
63
|
|
|
public function greaterThanOrEqual($propertyName, $operand) {} |
64
|
|
|
public function getType() {} |
65
|
|
|
public function setQuerySettings(QuerySettingsInterface $querySettings) {} |
66
|
|
|
public function getQuerySettings() {} |
67
|
|
|
|
68
|
|
|
public function count() |
69
|
|
|
{ |
70
|
|
|
// TODO? |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getOrderings() {} |
74
|
|
|
|
75
|
|
|
public function getLimit() |
76
|
|
|
{ |
77
|
|
|
return $this->limit; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function getOffset() |
81
|
|
|
{ |
82
|
|
|
return $this->offset; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getConstraint() {} |
86
|
|
|
public function isEmpty($propertyName) {} |
87
|
|
|
public function setSource(SourceInterface $source) {} |
88
|
|
|
public function getStatement() {} |
89
|
|
|
} |
90
|
|
|
|