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) |
||
118 | |||
119 | /** |
||
120 | * Perform the given search on the engine. |
||
121 | * |
||
122 | * @param \Laravel\Scout\Builder $builder |
||
123 | * @param int $perPage |
||
124 | * @param int $page |
||
125 | * |
||
126 | * @return mixed |
||
127 | */ |
||
128 | public function paginate(Builder $builder, $perPage, $page) |
||
145 | |||
146 | /** |
||
147 | * Pluck and return the primary keys of the given results. |
||
148 | * |
||
149 | * @param mixed $results |
||
150 | * |
||
151 | * @return \Illuminate\Support\Collection |
||
152 | */ |
||
153 | public function mapIds($results) |
||
157 | |||
158 | /** |
||
159 | * Map the given results to instances of the given model. |
||
160 | * |
||
161 | * @param mixed $results |
||
162 | * @param \Illuminate\Database\Eloquent\Model $model |
||
163 | * |
||
164 | * @return \Illuminate\Database\Eloquent\Collection |
||
165 | */ |
||
166 | public function map($results, $model) |
||
188 | |||
189 | /** |
||
190 | * Get the total count from a raw result returned by the engine. |
||
191 | * |
||
192 | * @param mixed $results |
||
193 | * |
||
194 | * @return int |
||
195 | */ |
||
196 | public function getTotalCount($results) |
||
200 | } |
||
201 |