1 | <?php |
||
10 | class TNTSearchEngine extends Engine |
||
11 | { |
||
12 | /** |
||
13 | * @var TNTSearch |
||
14 | */ |
||
15 | protected $tnt; |
||
16 | |||
17 | /** |
||
18 | * @var Builder |
||
19 | */ |
||
20 | protected $builder; |
||
21 | |||
22 | /** |
||
23 | * Create a new engine instance. |
||
24 | * |
||
25 | * @param TNTSearch $tnt |
||
26 | */ |
||
27 | public function __construct(TNTSearch $tnt) |
||
31 | |||
32 | /** |
||
33 | * Update the given model in the index. |
||
34 | * |
||
35 | * @param Collection $models |
||
36 | * |
||
37 | * @return void |
||
38 | */ |
||
39 | public function update($models) |
||
56 | |||
57 | /** |
||
58 | * Remove the given model from the index. |
||
59 | * |
||
60 | * @param Collection $models |
||
61 | * |
||
62 | * @return void |
||
63 | */ |
||
64 | public function delete($models) |
||
74 | |||
75 | /** |
||
76 | * Perform the given search on the engine. |
||
77 | * |
||
78 | * @param Builder $builder |
||
79 | * |
||
80 | * @return mixed |
||
81 | */ |
||
82 | public function search(Builder $builder) |
||
86 | |||
87 | /** |
||
88 | * Perform the given search on the engine. |
||
89 | * |
||
90 | * @param Builder $builder |
||
91 | * @param int $perPage |
||
92 | * @param int $page |
||
93 | * |
||
94 | * @return mixed |
||
95 | */ |
||
96 | public function paginate(Builder $builder, $perPage, $page) |
||
116 | |||
117 | /** |
||
118 | * Perform the given search on the engine. |
||
119 | * |
||
120 | * @param Builder $builder |
||
121 | * |
||
122 | * @return mixed |
||
123 | */ |
||
124 | protected function performSearch(Builder $builder) |
||
134 | |||
135 | /** |
||
136 | * Get the filter array for the query. |
||
137 | * |
||
138 | * @param Builder $builder |
||
139 | * |
||
140 | * @return array |
||
141 | */ |
||
142 | protected function filters(Builder $builder) |
||
148 | |||
149 | /** |
||
150 | * Map the given results to instances of the given model. |
||
151 | * |
||
152 | * @param mixed $results |
||
153 | * @param \Illuminate\Database\Eloquent\Model $model |
||
154 | * |
||
155 | * @return Collection |
||
156 | */ |
||
157 | public function map($results, $model) |
||
177 | |||
178 | /** |
||
179 | * Pluck and return the primary keys of the given results. |
||
180 | * |
||
181 | * @param mixed $results |
||
182 | * @return \Illuminate\Support\Collection |
||
183 | */ |
||
184 | public function mapIds($results) |
||
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 | public function initIndex($model) |
||
211 | } |
||
212 |