1 | <?php |
||
11 | class ScoutElasticEngine extends Engine |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * The Elasticsearch client. |
||
16 | * |
||
17 | * @var \Elasticsearch\Client |
||
18 | */ |
||
19 | private $client; |
||
20 | |||
21 | /** |
||
22 | * ElasticSearchScoutEngine constructor. |
||
23 | * |
||
24 | * @param \Elasticsearch\Client $client |
||
25 | */ |
||
26 | public function __construct(Client $client) |
||
30 | |||
31 | /** |
||
32 | * Update the given model in the index. |
||
33 | * |
||
34 | * @param \Illuminate\Database\Eloquent\Collection $models |
||
35 | * |
||
36 | * @return void |
||
37 | */ |
||
38 | public function update($models) |
||
62 | |||
63 | /** |
||
64 | * Remove the given model from the index. |
||
65 | * |
||
66 | * @param \Illuminate\Database\Eloquent\Collection $models |
||
67 | * |
||
68 | * @return void |
||
69 | */ |
||
70 | public function delete($models) |
||
87 | |||
88 | /** |
||
89 | * Perform the given search on the engine. |
||
90 | * |
||
91 | * @param \Laravel\Scout\Builder $builder |
||
92 | * |
||
93 | * @return mixed |
||
94 | */ |
||
95 | public function search(Builder $builder) |
||
101 | |||
102 | /** |
||
103 | * Perform the given search on the engine. |
||
104 | * |
||
105 | * @param \Laravel\Scout\Builder $builder |
||
106 | * @param int $perPage |
||
107 | * @param int $page |
||
108 | * |
||
109 | * @return mixed |
||
110 | */ |
||
111 | public function paginate(Builder $builder, $perPage, $page) |
||
121 | |||
122 | /** |
||
123 | * Pluck and return the primary keys of the given results. |
||
124 | * |
||
125 | * @param mixed $results |
||
126 | * |
||
127 | * @return \Illuminate\Support\Collection |
||
128 | */ |
||
129 | public function mapIds($results) |
||
133 | |||
134 | /** |
||
135 | * Map the given results to instances of the given model. |
||
136 | * |
||
137 | * @param mixed $results |
||
138 | * @param \Illuminate\Database\Eloquent\Model $model |
||
139 | * |
||
140 | * @return \Illuminate\Database\Eloquent\Collection |
||
141 | */ |
||
142 | public function map($results, $model) |
||
164 | |||
165 | /** |
||
166 | * Get the total count from a raw result returned by the engine. |
||
167 | * |
||
168 | * @param mixed $results |
||
169 | * |
||
170 | * @return int |
||
171 | */ |
||
172 | public function getTotalCount($results) |
||
176 | |||
177 | /** |
||
178 | * Parse and prepare the params to send to Elasticsearch client |
||
179 | * |
||
180 | * @param \Laravel\Scout\Builder $builder |
||
181 | * |
||
182 | * @return array |
||
183 | */ |
||
184 | protected function prepareParams(Builder $builder) |
||
211 | } |
||
212 |