@@ -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'); |
@@ -43,6 +43,9 @@ discard block |
||
43 | 43 | }); |
44 | 44 | } |
45 | 45 | |
46 | + /** |
|
47 | + * @param TNTSearch $tnt |
|
48 | + */ |
|
46 | 49 | protected function setFuzziness($tnt) |
47 | 50 | { |
48 | 51 | $tnt->fuzziness = config('scout.tntsearch.fuzziness', $tnt->fuzziness); |
@@ -51,6 +54,9 @@ discard block |
||
51 | 54 | $tnt->fuzzy_max_expansions = config('scout.tntsearch.fuzzy.max_expansions', $tnt->fuzzy_max_expansions); |
52 | 55 | } |
53 | 56 | |
57 | + /** |
|
58 | + * @param TNTSearch $tnt |
|
59 | + */ |
|
54 | 60 | protected function setAsYouType($tnt) |
55 | 61 | { |
56 | 62 | $tnt->asYouType = config('scout.tntsearch.asYouType', $tnt->asYouType); |
@@ -291,6 +291,7 @@ |
||
291 | 291 | * The constraints usually remove only a small amount of results, which is why the non |
292 | 292 | * matching results are looked up and removed, instead of returning a collection with |
293 | 293 | * all the valid results. |
294 | + * @param Builder $builder |
|
294 | 295 | */ |
295 | 296 | private function discardIdsFromResultSetByConstraints($builder, $searchResults) |
296 | 297 | { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $index->setPrimaryKey($models->first()->getKeyName()); |
48 | 48 | |
49 | 49 | $index->indexBeginTransaction(); |
50 | - $models->each(function ($model) use ($index) { |
|
50 | + $models->each(function($model) use ($index) { |
|
51 | 51 | $array = $model->toSearchableArray(); |
52 | 52 | |
53 | 53 | if (empty($array)) { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function delete($models) |
74 | 74 | { |
75 | 75 | $this->initIndex($models->first()); |
76 | - $models->each(function ($model) { |
|
76 | + $models->each(function($model) { |
|
77 | 77 | $this->tnt->selectIndex("{$model->searchableAs()}.index"); |
78 | 78 | $index = $this->tnt->getIndex(); |
79 | 79 | $index->setPrimaryKey($model->getKeyName()); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | // sort models by tnt search result set |
202 | - return $model->newCollection($results['ids'])->map(function ($hit) use ($models) { |
|
202 | + return $model->newCollection($results['ids'])->map(function($hit) use ($models) { |
|
203 | 203 | if (isset($models[$hit])) { |
204 | 204 | return $models[$hit]; |
205 | 205 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | $discardIds = $builder->model->newQuery() |
290 | 290 | ->select($qualifiedKeyName) |
291 | - ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '. $builder->model->getConnection()->getTablePrefix() .'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
291 | + ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '.$builder->model->getConnection()->getTablePrefix().'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
292 | 292 | ->addBinding($sub->getQuery()->getBindings(), 'join') |
293 | 293 | ->whereIn($qualifiedKeyName, $searchResults) |
294 | 294 | ->whereNull($subQualifiedKeyName) |
@@ -359,10 +359,10 @@ discard block |
||
359 | 359 | private function applyWheres($builder) |
360 | 360 | { |
361 | 361 | // iterate over given where clauses |
362 | - return collect($this->builder->wheres)->map(function ($value, $key) { |
|
362 | + return collect($this->builder->wheres)->map(function($value, $key) { |
|
363 | 363 | // for reduce function combine key and value into array |
364 | 364 | return [$key, $value]; |
365 | - })->reduce(function ($builder, $where) { |
|
365 | + })->reduce(function($builder, $where) { |
|
366 | 366 | // separate key, value again |
367 | 367 | list($key, $value) = $where; |
368 | 368 | return $builder->where($key, $value); |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | private function applyOrders($builder) |
379 | 379 | { |
380 | 380 | //iterate over given orderBy clauses - should be only one |
381 | - return collect($this->builder->orders)->map(function ($value, $key) { |
|
381 | + return collect($this->builder->orders)->map(function($value, $key) { |
|
382 | 382 | // for reduce function combine key and value into array |
383 | 383 | return [$value["column"], $value["direction"]]; |
384 | - })->reduce(function ($builder, $orderBy) { |
|
384 | + })->reduce(function($builder, $orderBy) { |
|
385 | 385 | // separate key, value again |
386 | 386 | list($column, $direction) = $orderBy; |
387 | 387 | return $builder->orderBy($column, $direction); |
@@ -129,7 +129,7 @@ |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | - * @param $trait |
|
132 | + * @param string $trait |
|
133 | 133 | * @return \Closure |
134 | 134 | */ |
135 | 135 | private function isSearchableModel($trait) |
@@ -5,9 +5,7 @@ |
||
5 | 5 | use Illuminate\Console\Command; |
6 | 6 | use Illuminate\Contracts\Events\Dispatcher; |
7 | 7 | use TeamTNT\TNTSearch\Exceptions\IndexNotFoundException; |
8 | -use TeamTNT\TNTSearch\Indexer\TNTIndexer; |
|
9 | 8 | use TeamTNT\TNTSearch\TNTSearch; |
10 | -use Illuminate\Support\Facades\Schema; |
|
11 | 9 | use Symfony\Component\Finder\Finder; |
12 | 10 | |
13 | 11 | class StatusCommand extends Command |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $rowsTotal = $model->count(); |
69 | 69 | $recordsDifference = $rowsTotal - $rowsIndexed; |
70 | 70 | |
71 | - if($recordsDifference == 0) { |
|
71 | + if ($recordsDifference == 0) { |
|
72 | 72 | $recordsDifference = '<fg=green>Synchronized</>'; |
73 | 73 | } else { |
74 | 74 | $recordsDifference = "<fg=red>$recordsDifference</>"; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | private function getSearchableModels() |
122 | 122 | { |
123 | - $searchableModels = (array)$this->argument('model'); |
|
123 | + $searchableModels = (array) $this->argument('model'); |
|
124 | 124 | if (empty($searchableModels)) { |
125 | 125 | $searchableModels = $this->getSearchableModelsFromClasses(); |
126 | 126 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private function isSearchableModel($trait) |
136 | 136 | { |
137 | - return function ($className) use ($trait) { |
|
137 | + return function($className) use ($trait) { |
|
138 | 138 | $traits = class_uses($className); |
139 | 139 | |
140 | 140 | return isset($traits[$trait]); |