1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace Xervice\Elasticsearch\Business; |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
use DataProvider\DocumentListDataProvider; |
8
|
|
|
use DataProvider\ElasticsearchResultSetDataProvider; |
9
|
|
|
use DataProvider\SearchDataProvider; |
|
|
|
|
10
|
|
|
use Elastica\Query; |
11
|
|
|
use Elastica\ResultSet; |
12
|
|
|
use Xervice\Core\Business\Model\Facade\AbstractFacade; |
13
|
|
|
use Xervice\Elasticsearch\Dependency\Plugin\DocumentBuilderPlugin; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @method \Xervice\Elasticsearch\Business\ElasticsearchBusinessFactory getFactory() |
17
|
|
|
* @method \Xervice\Elasticsearch\ElasticsearchConfig getConfig() |
18
|
|
|
*/ |
19
|
|
|
class ElasticsearchFacade extends AbstractFacade |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Generate all indizes in elasticsearch |
23
|
|
|
* |
24
|
|
|
* @api |
25
|
|
|
*/ |
26
|
1 |
|
public function createIndizes(): void |
27
|
|
|
{ |
28
|
|
|
$this |
29
|
1 |
|
->getFactory() |
30
|
1 |
|
->createIndexer() |
31
|
1 |
|
->createIndizes(); |
32
|
1 |
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Create a list of documents in elasticsearch |
36
|
|
|
* |
37
|
|
|
* @api |
38
|
|
|
* |
39
|
|
|
* @param \DataProvider\DocumentListDataProvider $listDataProvider |
40
|
|
|
*/ |
41
|
1 |
|
public function createDocuments(DocumentListDataProvider $listDataProvider): void |
42
|
|
|
{ |
43
|
|
|
$this |
44
|
1 |
|
->getFactory() |
45
|
1 |
|
->createDocumentBuilder() |
46
|
1 |
|
->createDocuments($listDataProvider); |
47
|
1 |
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Remove a list of documents in elasticsearch |
51
|
|
|
* |
52
|
|
|
* @api |
53
|
|
|
* |
54
|
|
|
* @param \DataProvider\DocumentListDataProvider $listDataProvider |
55
|
|
|
*/ |
56
|
1 |
|
public function deleteDocuments(DocumentListDataProvider $listDataProvider): void |
57
|
|
|
{ |
58
|
|
|
$this |
59
|
1 |
|
->getFactory() |
60
|
1 |
|
->createDocumentCleaner() |
61
|
1 |
|
->deleteDocuments($listDataProvider); |
62
|
1 |
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Send search request to elasticsearch |
66
|
|
|
* QueryExtenderPlugins can extend the query |
67
|
|
|
* ResultFormatterPlugins can format the result DataProvider |
68
|
|
|
* |
69
|
|
|
* @api |
70
|
|
|
* |
71
|
|
|
* @param string $index |
72
|
|
|
* @param \Elastica\Query $query |
73
|
|
|
* @param array $queryExtender |
74
|
|
|
* @param array $resultFormatter |
75
|
|
|
* |
76
|
|
|
* @return \DataProvider\ElasticsearchResultSetDataProvider |
77
|
|
|
*/ |
78
|
1 |
|
public function search( |
79
|
|
|
string $index, |
80
|
|
|
Query $query, |
81
|
|
|
array $queryExtender = [], |
82
|
|
|
array $resultFormatter = [] |
83
|
|
|
): ElasticsearchResultSetDataProvider { |
84
|
|
|
return $this |
85
|
1 |
|
->getFactory() |
86
|
1 |
|
->createSearch($queryExtender, $resultFormatter) |
87
|
1 |
|
->search($index, $query); |
88
|
|
|
} |
89
|
|
|
} |
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