1 | <?php |
||
11 | class TNTSearchEngine extends Engine |
||
12 | { |
||
13 | /** |
||
14 | * @var TNTSearch |
||
15 | */ |
||
16 | protected $tnt; |
||
17 | |||
18 | /** |
||
19 | * @var Builder |
||
20 | */ |
||
21 | protected $builder; |
||
22 | |||
23 | /** |
||
24 | * Create a new engine instance. |
||
25 | * |
||
26 | * @param TNTSearch $tnt |
||
27 | */ |
||
28 | public function __construct(TNTSearch $tnt) |
||
32 | |||
33 | /** |
||
34 | * Update the given model in the index. |
||
35 | * |
||
36 | * @param Collection $models |
||
37 | * |
||
38 | * @return void |
||
39 | */ |
||
40 | public function update($models) |
||
57 | |||
58 | /** |
||
59 | * Remove the given model from the index. |
||
60 | * |
||
61 | * @param Collection $models |
||
62 | * |
||
63 | * @return void |
||
64 | */ |
||
65 | public function delete($models) |
||
75 | |||
76 | /** |
||
77 | * Perform the given search on the engine. |
||
78 | * |
||
79 | * @param Builder $builder |
||
80 | * |
||
81 | * @return mixed |
||
82 | */ |
||
83 | public function search(Builder $builder) |
||
91 | |||
92 | /** |
||
93 | * Perform the given search on the engine. |
||
94 | * |
||
95 | * @param Builder $builder |
||
96 | * @param int $perPage |
||
97 | * @param int $page |
||
98 | * |
||
99 | * @return mixed |
||
100 | */ |
||
101 | public function paginate(Builder $builder, $perPage, $page) |
||
121 | |||
122 | /** |
||
123 | * Perform the given search on the engine. |
||
124 | * |
||
125 | * @param Builder $builder |
||
126 | * |
||
127 | * @return mixed |
||
128 | */ |
||
129 | protected function performSearch(Builder $builder, array $options = []) |
||
149 | |||
150 | /** |
||
151 | * Get the filter array for the query. |
||
152 | * |
||
153 | * @param Builder $builder |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | protected function filters(Builder $builder) |
||
163 | |||
164 | /** |
||
165 | * Map the given results to instances of the given model. |
||
166 | * |
||
167 | * @param mixed $results |
||
168 | * @param \Illuminate\Database\Eloquent\Model $model |
||
169 | * |
||
170 | * @return Collection |
||
171 | */ |
||
172 | public function map($results, $model) |
||
192 | |||
193 | /** |
||
194 | * Pluck and return the primary keys of the given results. |
||
195 | * |
||
196 | * @param mixed $results |
||
197 | * @return \Illuminate\Support\Collection |
||
198 | */ |
||
199 | public function mapIds($results) |
||
203 | |||
204 | /** |
||
205 | * Get the total count from a raw result returned by the engine. |
||
206 | * |
||
207 | * @param mixed $results |
||
208 | * |
||
209 | * @return int |
||
210 | */ |
||
211 | public function getTotalCount($results) |
||
215 | |||
216 | public function initIndex($model) |
||
226 | } |