@@ -37,6 +37,9 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | + /** |
|
| 41 | + * @param TNTSearch $tnt |
|
| 42 | + */ |
|
| 40 | 43 | protected function setFuzziness($tnt) |
| 41 | 44 | { |
| 42 | 45 | $tnt->fuzziness = config('scout.tntsearch.fuzziness', $tnt->fuzziness); |
@@ -45,6 +48,9 @@ discard block |
||
| 45 | 48 | $tnt->fuzzy_max_expansions = config('scout.tntsearch.fuzzy.max_expansions', $tnt->fuzzy_max_expansions); |
| 46 | 49 | } |
| 47 | 50 | |
| 51 | + /** |
|
| 52 | + * @param TNTSearch $tnt |
|
| 53 | + */ |
|
| 48 | 54 | protected function setAsYouType($tnt) |
| 49 | 55 | { |
| 50 | 56 | $tnt->asYouType = config('scout.tntsearch.asYouType', $tnt->asYouType); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function boot() |
| 17 | 17 | { |
| 18 | - $this->app[EngineManager::class]->extend('tntsearch', function ($app) { |
|
| 18 | + $this->app[EngineManager::class]->extend('tntsearch', function($app) { |
|
| 19 | 19 | $tnt = new TNTSearch(); |
| 20 | 20 | |
| 21 | 21 | $driver = config('database.default'); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $index->setPrimaryKey($models->first()->getKeyName()); |
| 46 | 46 | |
| 47 | 47 | $index->indexBeginTransaction(); |
| 48 | - $models->each(function ($model) use ($index) { |
|
| 48 | + $models->each(function($model) use ($index) { |
|
| 49 | 49 | $array = $model->toSearchableArray(); |
| 50 | 50 | |
| 51 | 51 | if (empty($array)) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function delete($models) |
| 72 | 72 | { |
| 73 | 73 | $this->initIndex($models->first()); |
| 74 | - $models->each(function ($model) { |
|
| 74 | + $models->each(function($model) { |
|
| 75 | 75 | $this->tnt->selectIndex("{$model->searchableAs()}.index"); |
| 76 | 76 | $index = $this->tnt->getIndex(); |
| 77 | 77 | $index->setPrimaryKey($model->getKeyName()); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | protected function filters(Builder $builder) |
| 167 | 167 | { |
| 168 | - return collect($builder->wheres)->map(function ($value, $key) { |
|
| 168 | + return collect($builder->wheres)->map(function($value, $key) { |
|
| 169 | 169 | return $key.'='.$value; |
| 170 | 170 | })->values()->all(); |
| 171 | 171 | } |
@@ -190,10 +190,10 @@ discard block |
||
| 190 | 190 | $model->getQualifiedKeyName(), $keys |
| 191 | 191 | )->get()->keyBy($model->getKeyName()); |
| 192 | 192 | |
| 193 | - return collect($results['ids'])->map(function ($hit) use ($models) { |
|
| 193 | + return collect($results['ids'])->map(function($hit) use ($models) { |
|
| 194 | 194 | return $models->has($hit) ? $models[$hit] : null; |
| 195 | - })->filter(function ($model) use ($fieldsWheres) { |
|
| 196 | - return !is_null($model) && array_reduce($fieldsWheres, function ($carry, $item) use($model) { |
|
| 195 | + })->filter(function($model) use ($fieldsWheres) { |
|
| 196 | + return !is_null($model) && array_reduce($fieldsWheres, function($carry, $item) use($model) { |
|
| 197 | 197 | return $carry && $model[$item] == $this->builder->wheres[$item]; |
| 198 | 198 | }, true); |
| 199 | 199 | }); |