1 | <?php |
||
10 | class TNTSearchEngine extends Engine |
||
11 | { |
||
12 | /** |
||
13 | * @var TNTSearch |
||
14 | */ |
||
15 | protected $tnt; |
||
16 | |||
17 | /** |
||
18 | * Create a new engine instance. |
||
19 | * |
||
20 | * @param TNTSearch $tnt |
||
21 | */ |
||
22 | public function __construct(TNTSearch $tnt) |
||
26 | |||
27 | /** |
||
28 | * Update the given model in the index. |
||
29 | * |
||
30 | * @param Collection $models |
||
31 | * |
||
32 | * @return void |
||
33 | */ |
||
34 | public function update($models) |
||
51 | |||
52 | /** |
||
53 | * Remove the given model from the index. |
||
54 | * |
||
55 | * @param Collection $models |
||
56 | * |
||
57 | * @return void |
||
58 | */ |
||
59 | public function delete($models) |
||
69 | |||
70 | /** |
||
71 | * Perform the given search on the engine. |
||
72 | * |
||
73 | * @param Builder $builder |
||
74 | * |
||
75 | * @return mixed |
||
76 | */ |
||
77 | public function search(Builder $builder) |
||
81 | |||
82 | /** |
||
83 | * Perform the given search on the engine. |
||
84 | * |
||
85 | * @param Builder $builder |
||
86 | * @param int $perPage |
||
87 | * @param int $page |
||
88 | * |
||
89 | * @return mixed |
||
90 | */ |
||
91 | public function paginate(Builder $builder, $perPage, $page) |
||
107 | |||
108 | /** |
||
109 | * Perform the given search on the engine. |
||
110 | * |
||
111 | * @param Builder $builder |
||
112 | * |
||
113 | * @return mixed |
||
114 | */ |
||
115 | protected function performSearch(Builder $builder) |
||
123 | |||
124 | /** |
||
125 | * Get the filter array for the query. |
||
126 | * |
||
127 | * @param Builder $builder |
||
128 | * |
||
129 | * @return array |
||
130 | */ |
||
131 | protected function filters(Builder $builder) |
||
137 | |||
138 | /** |
||
139 | * Map the given results to instances of the given model. |
||
140 | * |
||
141 | * @param mixed $results |
||
142 | * @param \Illuminate\Database\Eloquent\Model $model |
||
143 | * |
||
144 | * @return Collection |
||
145 | */ |
||
146 | public function map($results, $model) |
||
161 | |||
162 | /** |
||
163 | * Get the total count from a raw result returned by the engine. |
||
164 | * |
||
165 | * @param mixed $results |
||
166 | * @return int |
||
167 | */ |
||
168 | public function getTotalCount($results) |
||
172 | |||
173 | public function initIndex($model) |
||
187 | } |
||
188 |