1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Shopware\Elasticsearch\Admin\Indexer; |
4
|
|
|
|
5
|
|
|
use ONGR\ElasticsearchDSL\Search; |
6
|
|
|
use Shopware\Core\Framework\Context; |
7
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Dbal\Common\IterableQuery; |
8
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Entity; |
9
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection; |
10
|
|
|
use Shopware\Core\Framework\Log\Package; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @internal |
14
|
|
|
*/ |
15
|
|
|
#[Package('system-settings')] |
16
|
|
|
abstract class AbstractAdminIndexer |
17
|
|
|
{ |
18
|
|
|
abstract public function getDecorated(): self; |
19
|
|
|
|
20
|
|
|
abstract public function getName(): string; |
21
|
|
|
|
22
|
|
|
abstract public function getEntity(): string; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @param array<string, array<string, array<string, string>>> $mapping |
26
|
|
|
* |
27
|
|
|
* @return array<string, array<string, array<string, string>>> |
28
|
|
|
*/ |
29
|
|
|
public function mapping(array $mapping): array |
30
|
|
|
{ |
31
|
|
|
return $mapping; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
abstract public function getIterator(): IterableQuery; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param array<string>|array<int, array<string>> $ids |
38
|
|
|
* |
39
|
|
|
* @return array<string, array<string, string>> |
40
|
|
|
*/ |
41
|
|
|
abstract public function fetch(array $ids): array; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param array<string, mixed> $result |
45
|
|
|
* |
46
|
|
|
* @return array{total:int, data:EntityCollection<Entity>} |
|
|
|
|
47
|
|
|
* |
48
|
|
|
* Return EntityCollection<Entity> and their total by ids in the result parameter |
49
|
|
|
*/ |
50
|
|
|
abstract public function globalData(array $result, Context $context): array; |
51
|
|
|
|
52
|
|
|
public function globalCriteria(string $term, Search $criteria): Search |
|
|
|
|
53
|
|
|
{ |
54
|
|
|
return $criteria; |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|