@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function register() |
| 17 | 17 | { |
| 18 | - $this->app[EngineManager::class]->extend('tntsearch', function () { |
|
| 18 | + $this->app[EngineManager::class]->extend('tntsearch', function() { |
|
| 19 | 19 | $tnt = new TNTSearch(); |
| 20 | 20 | $tnt->loadConfig(config('scout.tntsearch')); |
| 21 | 21 | |
@@ -37,6 +37,9 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | + /** |
|
| 41 | + * @param TNTSearch $tnt |
|
| 42 | + */ |
|
| 40 | 43 | private function setFuzziness($tnt) |
| 41 | 44 | { |
| 42 | 45 | $fuzziness = config('scout.tntsearch.fuzziness'); |
@@ -51,6 +54,9 @@ discard block |
||
| 51 | 54 | $tnt->fuzzy_distance = isset($distance) ? $distance : $tnt->fuzzy_distance; |
| 52 | 55 | } |
| 53 | 56 | |
| 57 | + /** |
|
| 58 | + * @param TNTSearch $tnt |
|
| 59 | + */ |
|
| 54 | 60 | private function setAsYouType($tnt) |
| 55 | 61 | { |
| 56 | 62 | $asYouType = config('scout.tntsearch.asYouType'); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $index->setPrimaryKey($models->first()->getKeyName()); |
| 40 | 40 | |
| 41 | 41 | $index->indexBeginTransaction(); |
| 42 | - $models->each(function ($model) use ($index) { |
|
| 42 | + $models->each(function($model) use ($index) { |
|
| 43 | 43 | if ($model->getKey()) { |
| 44 | 44 | $index->update($model->getKey(), $model->toSearchableArray()); |
| 45 | 45 | } else { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function delete($models) |
| 60 | 60 | { |
| 61 | 61 | $this->initIndex($models->first()); |
| 62 | - $models->each(function ($model) { |
|
| 62 | + $models->each(function($model) { |
|
| 63 | 63 | $this->tnt->selectIndex("{$model->searchableAs()}.index"); |
| 64 | 64 | $index = $this->tnt->getIndex(); |
| 65 | 65 | $index->setPrimaryKey($model->getKeyName()); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function filters(Builder $builder) |
| 136 | 136 | { |
| 137 | - return collect($builder->wheres)->map(function ($value, $key) { |
|
| 137 | + return collect($builder->wheres)->map(function($value, $key) { |
|
| 138 | 138 | return $key.'='.$value; |
| 139 | 139 | })->values()->all(); |
| 140 | 140 | } |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | $model->getQualifiedKeyName(), $keys |
| 159 | 159 | )->get()->keyBy($model->getKeyName()); |
| 160 | 160 | |
| 161 | - return collect($results['ids'])->map(function ($hit) use ($models) { |
|
| 161 | + return collect($results['ids'])->map(function($hit) use ($models) { |
|
| 162 | 162 | return $models->has($hit) ? $models[$hit] : null; |
| 163 | - })->filter(function ($model) { |
|
| 163 | + })->filter(function($model) { |
|
| 164 | 164 | return !is_null($model); |
| 165 | 165 | }); |
| 166 | 166 | } |