1 | <?php |
||
10 | class ScoutElasticEngine extends Engine |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * The Elasticsearch client. |
||
15 | * |
||
16 | * @var \Elasticsearch\Client |
||
17 | */ |
||
18 | private $client; |
||
19 | |||
20 | /** |
||
21 | * ElasticSearchScoutEngine constructor. |
||
22 | * |
||
23 | * @param \Elasticsearch\Client $client |
||
24 | */ |
||
25 | public function __construct(Client $client) |
||
29 | |||
30 | /** |
||
31 | * Update the given model in the index. |
||
32 | * |
||
33 | * @param \Illuminate\Database\Eloquent\Collection $models |
||
34 | * |
||
35 | * @return void |
||
36 | */ |
||
37 | public function update($models) |
||
61 | |||
62 | /** |
||
63 | * Remove the given model from the index. |
||
64 | * |
||
65 | * @param \Illuminate\Database\Eloquent\Collection $models |
||
66 | * |
||
67 | * @return void |
||
68 | */ |
||
69 | public function delete($models) |
||
86 | |||
87 | /** |
||
88 | * Perform the given search on the engine. |
||
89 | * |
||
90 | * @param \Laravel\Scout\Builder $builder |
||
91 | * |
||
92 | * @return mixed |
||
93 | */ |
||
94 | public function search(Builder $builder) |
||
120 | |||
121 | /** |
||
122 | * Perform the given search on the engine. |
||
123 | * |
||
124 | * @param \Laravel\Scout\Builder $builder |
||
125 | * @param int $perPage |
||
126 | * @param int $page |
||
127 | * |
||
128 | * @return mixed |
||
129 | */ |
||
130 | public function paginate(Builder $builder, $perPage, $page) |
||
158 | |||
159 | /** |
||
160 | * Pluck and return the primary keys of the given results. |
||
161 | * |
||
162 | * @param mixed $results |
||
163 | * |
||
164 | * @return \Illuminate\Support\Collection |
||
165 | */ |
||
166 | public function mapIds($results) |
||
170 | |||
171 | /** |
||
172 | * Map the given results to instances of the given model. |
||
173 | * |
||
174 | * @param mixed $results |
||
175 | * @param \Illuminate\Database\Eloquent\Model $model |
||
176 | * |
||
177 | * @return \Illuminate\Database\Eloquent\Collection |
||
178 | */ |
||
179 | public function map($results, $model) |
||
201 | |||
202 | /** |
||
203 | * Get the total count from a raw result returned by the engine. |
||
204 | * |
||
205 | * @param mixed $results |
||
206 | * |
||
207 | * @return int |
||
208 | */ |
||
209 | public function getTotalCount($results) |
||
213 | } |
||
214 |