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