1 | <?php |
||
35 | class PMF_Search_Elasticsearch extends PMF_Search_Abstract implements PMF_Search_Interface |
||
36 | { |
||
37 | /** @var Client */ |
||
38 | private $client = null; |
||
39 | |||
40 | /** @var array */ |
||
41 | private $esConfig = []; |
||
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 | /** |
||
78 | * Constructor. |
||
79 | * |
||
80 | * @param PMF_Configuration |
||
81 | */ |
||
82 | public function __construct(PMF_Configuration $config) |
||
89 | |||
90 | /** |
||
91 | * Prepares the search and executes it. |
||
92 | * |
||
93 | * @param string $searchTerm Search term |
||
94 | * |
||
95 | * @return resource |
||
96 | * |
||
97 | * @throws PMF_Search_Exception |
||
98 | */ |
||
99 | public function search($searchTerm) |
||
103 | |||
104 | public function index(Array $faq) |
||
108 | |||
109 | public function bulkIndex(Array $faqs) |
||
113 | |||
114 | public function update(Array $faq) |
||
118 | |||
119 | public function delete($faqId) |
||
123 | |||
124 | /** |
||
125 | * Puts phpMyFAQ Elasticsearch mapping into index. |
||
126 | * |
||
127 | * @return bool |
||
128 | */ |
||
129 | public function putMapping() |
||
150 | |||
151 | /** |
||
152 | * Returns the current mapping. |
||
153 | * |
||
154 | * @return array |
||
155 | */ |
||
156 | public function getMapping() |
||
160 | } |
||
161 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.