1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of the OpCart software. |
4
|
|
|
* |
5
|
|
|
* (c) 2015, OpticsPlanet, Inc |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace FOS\ElasticaBundle\Configuration; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Index configuration trait class |
15
|
|
|
* |
16
|
|
|
* @author Dmitry Balabka <[email protected]> |
17
|
|
|
*/ |
18
|
|
|
trait IndexConfigTrait |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* The name of the index for ElasticSearch. |
22
|
|
|
* |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
private $elasticSearchName; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* The model of the index |
29
|
|
|
* |
30
|
|
|
* @var string|null |
31
|
|
|
*/ |
32
|
|
|
private $model; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* The internal name of the index. May not be the same as the name used in ElasticSearch, |
36
|
|
|
* especially if aliases are enabled. |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
private $name; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* An array of settings sent to ElasticSearch when creating the index. |
44
|
|
|
* |
45
|
|
|
* @var array |
46
|
|
|
*/ |
47
|
|
|
private $settings; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var array |
51
|
|
|
*/ |
52
|
|
|
private $config; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var array |
56
|
|
|
*/ |
57
|
|
|
private $mapping; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return string |
61
|
|
|
*/ |
62
|
11 |
|
public function getElasticSearchName(): string |
63
|
|
|
{ |
64
|
11 |
|
return $this->elasticSearchName; |
65
|
|
|
} |
66
|
|
|
|
67
|
8 |
|
public function getModel(): ?string |
68
|
|
|
{ |
69
|
8 |
|
return $this->model; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return string |
74
|
|
|
*/ |
75
|
3 |
|
public function getName(): string |
76
|
|
|
{ |
77
|
3 |
|
return $this->name; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return array |
82
|
|
|
*/ |
83
|
10 |
|
public function getSettings(): array |
84
|
|
|
{ |
85
|
10 |
|
return $this->settings; |
86
|
|
|
} |
87
|
|
|
|
88
|
10 |
|
public function getDateDetection(): ?bool |
89
|
|
|
{ |
90
|
10 |
|
return $this->config['date_detection'] ?? null; |
91
|
|
|
} |
92
|
|
|
|
93
|
9 |
|
public function getDynamicDateFormats(): ?array |
94
|
|
|
{ |
95
|
9 |
|
return $this->config['dynamic_date_formats'] ?? null; |
96
|
|
|
} |
97
|
|
|
|
98
|
9 |
|
public function getAnalyzer(): ?string |
99
|
|
|
{ |
100
|
9 |
|
return $this->config['analyzer'] ?? null; |
101
|
|
|
} |
102
|
|
|
|
103
|
10 |
|
public function getMapping(): array |
104
|
|
|
{ |
105
|
10 |
|
return $this->mapping; |
106
|
|
|
} |
107
|
|
|
|
108
|
9 |
|
public function getNumericDetection(): ?bool |
109
|
|
|
{ |
110
|
9 |
|
return $this->config['numeric_detection'] ?? null; |
111
|
|
|
} |
112
|
|
|
|
113
|
9 |
|
public function getDynamic() |
114
|
|
|
{ |
115
|
9 |
|
return $this->config['dynamic'] ?? null; |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|