1 | <?php |
||
35 | class PMF_Instance_Elasticsearch |
||
36 | { |
||
37 | /** @var PMF_Configuration */ |
||
38 | protected $config; |
||
39 | |||
40 | /** @var Client */ |
||
41 | protected $client; |
||
42 | |||
43 | /** |
||
44 | * Elasticsearch mapping |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | private $mappings = [ |
||
49 | 'faqs' => [ |
||
50 | '_source' => [ |
||
51 | 'enabled' => true |
||
52 | ], |
||
53 | 'properties' => [ |
||
54 | 'id' => [ |
||
55 | 'type' => 'integer' |
||
56 | ], |
||
57 | 'question' => [ |
||
58 | 'type' => 'string', |
||
59 | 'analyzer' => 'standard' |
||
60 | ], |
||
61 | 'answer' => [ |
||
62 | 'type' => 'string', |
||
63 | 'analyzer' => 'standard' |
||
64 | ], |
||
65 | 'keywords' => [ |
||
66 | 'type' => 'string', |
||
67 | 'analyzer' => 'standard' |
||
68 | ], |
||
69 | 'categories' => [ |
||
70 | 'type' => 'string', |
||
71 | 'analyzer' => 'standard' |
||
72 | ] |
||
73 | ] |
||
74 | ] |
||
75 | ]; |
||
76 | /** |
||
77 | * Constructor. |
||
78 | * |
||
79 | * @param PMF_Configuration $config |
||
80 | */ |
||
81 | public function __construct(PMF_Configuration $config) |
||
86 | |||
87 | /** |
||
88 | * Creates the Elasticsearch index. |
||
89 | * |
||
90 | * @return array |
||
91 | */ |
||
92 | public function createIndex() |
||
97 | |||
98 | /** |
||
99 | * Deletes the Elasticsearch index. |
||
100 | * |
||
101 | * @return array |
||
102 | */ |
||
103 | public function dropIndex() |
||
107 | |||
108 | /** |
||
109 | * Puts phpMyFAQ Elasticsearch mapping into index. |
||
110 | * |
||
111 | * @return bool |
||
112 | */ |
||
113 | public function putMapping() |
||
134 | |||
135 | /** |
||
136 | * Returns the current mapping. |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | public function getMapping() |
||
144 | |||
145 | public function index(Array $faq) |
||
149 | |||
150 | /** |
||
151 | * Bulk indexing of all FAQs |
||
152 | * |
||
153 | * @param array $faqs |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | public function bulkIndex(Array $faqs) |
||
196 | |||
197 | public function update(Array $faq) |
||
201 | |||
202 | public function delete($faqId) |
||
206 | |||
207 | /** |
||
208 | * Returns the basic phpMyFAQ index structure as raw array. |
||
209 | * |
||
210 | * @return array |
||
211 | */ |
||
212 | private function getParams() |
||
224 | } |
||
225 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..