@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $index->setPrimaryKey($models->first()->getKeyName()); |
| 45 | 45 | |
| 46 | 46 | $index->indexBeginTransaction(); |
| 47 | - $models->each(function ($model) use ($index) { |
|
| 47 | + $models->each(function($model) use ($index) { |
|
| 48 | 48 | if ($model->getKey()) { |
| 49 | 49 | $index->update($model->getKey(), $model->toSearchableArray()); |
| 50 | 50 | } else { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function delete($models) |
| 65 | 65 | { |
| 66 | 66 | $this->initIndex($models->first()); |
| 67 | - $models->each(function ($model) { |
|
| 67 | + $models->each(function($model) { |
|
| 68 | 68 | $this->tnt->selectIndex("{$model->searchableAs()}.index"); |
| 69 | 69 | $index = $this->tnt->getIndex(); |
| 70 | 70 | $index->setPrimaryKey($model->getKeyName()); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function filters(Builder $builder) |
| 143 | 143 | { |
| 144 | - return collect($builder->wheres)->map(function ($value, $key) { |
|
| 144 | + return collect($builder->wheres)->map(function($value, $key) { |
|
| 145 | 145 | return $key.'='.$value; |
| 146 | 146 | })->values()->all(); |
| 147 | 147 | } |
@@ -166,12 +166,12 @@ discard block |
||
| 166 | 166 | $model->getQualifiedKeyName(), $keys |
| 167 | 167 | )->get()->keyBy($model->getKeyName()); |
| 168 | 168 | |
| 169 | - return collect($results['ids'])->map(function ($hit) use ($models) { |
|
| 169 | + return collect($results['ids'])->map(function($hit) use ($models) { |
|
| 170 | 170 | return $models->has($hit) ? $models[$hit] : null; |
| 171 | - })->filter(function ($model) use ($fieldsWheres) { |
|
| 172 | - return !is_null($model) && array_reduce($fieldsWheres, function ($carry, $item) use($model) { |
|
| 171 | + })->filter(function($model) use ($fieldsWheres) { |
|
| 172 | + return !is_null($model) && array_reduce($fieldsWheres, function($carry, $item) use($model) { |
|
| 173 | 173 | return $carry && $model[$item] == $this->builder->wheres[$item]; |
| 174 | - }, true);; |
|
| 174 | + }, true); ; |
|
| 175 | 175 | }); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -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'); |