Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
Link | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 1 |
readSearchResultList | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | /** |
4 | * @package ClientDldb |
5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
6 | **/ |
7 | |
8 | namespace BO\Zmsdldb\Elastic; |
9 | |
10 | use BO\Zmsdldb\Entity\Link as Entity; |
11 | use BO\Zmsdldb\Collection\Links as Collection; |
12 | use BO\Zmsdldb\File\Link as Base; |
13 | |
14 | /** |
15 | */ |
16 | class Link extends Base |
17 | { |
18 | public function readSearchResultList($query) |
19 | { |
20 | $boolquery = Helper::boolFilteredQuery(); |
21 | $searchquery = new \Elastica\Query\QueryString(); |
22 | if ('' === trim($query)) { |
23 | $searchquery->setQuery('*'); |
24 | } else { |
25 | $searchquery->setQuery($query); |
26 | } |
27 | $searchquery->setFields([ |
28 | 'name^3', |
29 | 'meta.titles^5', |
30 | 'meta.keywords^9' |
31 | ]); |
32 | $boolquery->getQuery()->addShould($searchquery); |
33 | $resultList = $this->access() |
34 | ->getIndex() |
35 | ->getType('links') |
36 | ->search($boolquery, 1000); |
37 | $linkList = new Collection(); |
38 | foreach ($resultList as $result) { |
39 | $link = new Entity($result->getData()); |
40 | if (false === $linkList->offsetExists($link['link'])) { |
41 | $linkList[$link['link']] = $link; |
42 | } |
43 | } |
44 | return $linkList; |
45 | } |
46 | } |