|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Trait SearchResultGetTrait|Firesphere\SearchBackend\Traits\SearchResultGetTrait Getters for |
|
4
|
|
|
* {@link \Firesphere\SearchBackend\Interfaces\SearchResultInterface} |
|
5
|
|
|
* |
|
6
|
|
|
* @package Firesphere\Search\Backend |
|
7
|
|
|
* @author Simon `Firesphere` Erkelens; Marco `Sheepy` Hermo |
|
8
|
|
|
* @copyright Copyright (c) 2018 - now() Firesphere & Sheepy |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Firesphere\SearchBackend\Traits; |
|
12
|
|
|
|
|
13
|
|
|
use SilverStripe\ORM\ArrayList; |
|
14
|
|
|
use SilverStripe\View\ArrayData; |
|
15
|
|
|
use Solarium\Component\Highlighting\Highlighting; |
|
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Trait SearchResultGetTrait |
|
19
|
|
|
* |
|
20
|
|
|
* Getters for search results to keep the {@link SearchResult} class clean. |
|
21
|
|
|
* |
|
22
|
|
|
* @package Firesphere\Search\Backend |
|
23
|
|
|
*/ |
|
24
|
|
|
trait SearchResultGetTrait |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* @var int Total items in the result |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $totalItems = 0; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var ArrayData Facet results |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $facets; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var Highlighting Highlighting |
|
38
|
|
|
*/ |
|
39
|
|
|
protected $highlight; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var ArrayList Spellcheck results |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $spellcheck; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Retrieve the facets from the results |
|
48
|
|
|
* |
|
49
|
|
|
* @return ArrayData |
|
50
|
|
|
*/ |
|
51
|
|
|
public function getFacets(): ArrayData |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->facets ?? ArrayData::create(); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Get the highlighting |
|
58
|
|
|
* |
|
59
|
|
|
* @return array|Highlighting |
|
60
|
|
|
*/ |
|
61
|
|
|
public function getHighlight() |
|
62
|
|
|
{ |
|
63
|
|
|
return $this->highlight ?? []; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Get the spellchecked results |
|
68
|
|
|
* |
|
69
|
|
|
* @return ArrayList |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getSpellcheck(): ArrayList |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->spellcheck ?? ArrayList::create(); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Total items in the result |
|
78
|
|
|
* |
|
79
|
|
|
* @return int |
|
80
|
|
|
*/ |
|
81
|
|
|
public function getTotalItems(): int |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->totalItems; |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths