@@ -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 | { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | $index->indexBeginTransaction(); |
65 | - $models->each(function ($model) use ($index, $geoindex) { |
|
65 | + $models->each(function($model) use ($index, $geoindex) { |
|
66 | 66 | $array = $model->toSearchableArray(); |
67 | 67 | |
68 | 68 | if (empty($array)) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function delete($models) |
97 | 97 | { |
98 | 98 | $this->initIndex($models->first()); |
99 | - $models->each(function ($model) { |
|
99 | + $models->each(function($model) { |
|
100 | 100 | $this->tnt->selectIndex("{$model->searchableAs()}.index"); |
101 | 101 | $index = $this->tnt->getIndex(); |
102 | 102 | $index->setPrimaryKey($model->getKeyName()); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // sort models by tnt search result set |
243 | - return collect($results['ids'])->map(function ($hit) use ($models) { |
|
243 | + return collect($results['ids'])->map(function($hit) use ($models) { |
|
244 | 244 | if (isset($models[$hit])) { |
245 | 245 | return $models[$hit]; |
246 | 246 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | |
336 | 336 | $discardIds = $builder->model->newQuery() |
337 | 337 | ->select($qualifiedKeyName) |
338 | - ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '. $builder->model->getConnection()->getTablePrefix() .'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
338 | + ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '.$builder->model->getConnection()->getTablePrefix().'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
339 | 339 | ->addBinding($sub->getQuery()->getBindings(), 'join') |
340 | 340 | ->whereIn($qualifiedKeyName, $searchResults) |
341 | 341 | ->whereNull($subQualifiedKeyName) |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | private function applyWheres($builder) |
407 | 407 | { |
408 | 408 | // iterate over given where clauses |
409 | - return collect($this->builder->wheres)->map(function ($value, $key) { |
|
409 | + return collect($this->builder->wheres)->map(function($value, $key) { |
|
410 | 410 | // for reduce function combine key and value into array |
411 | 411 | return [$key, $value]; |
412 | - })->reduce(function ($builder, $where) { |
|
412 | + })->reduce(function($builder, $where) { |
|
413 | 413 | // separate key, value again |
414 | 414 | list($key, $value) = $where; |
415 | 415 | return $builder->where($key, $value); |
@@ -425,10 +425,10 @@ discard block |
||
425 | 425 | private function applyOrders($builder) |
426 | 426 | { |
427 | 427 | //iterate over given orderBy clauses - should be only one |
428 | - return collect($this->builder->orders)->map(function ($value, $key) { |
|
428 | + return collect($this->builder->orders)->map(function($value, $key) { |
|
429 | 429 | // for reduce function combine key and value into array |
430 | 430 | return [$value["column"], $value["direction"]]; |
431 | - })->reduce(function ($builder, $orderBy) { |
|
431 | + })->reduce(function($builder, $orderBy) { |
|
432 | 432 | // separate key, value again |
433 | 433 | list($column, $direction) = $orderBy; |
434 | 434 | return $builder->orderBy($column, $direction); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | unlink($pathToIndex); |
450 | 450 | } |
451 | 451 | |
452 | - if ($this->geotnt){ |
|
452 | + if ($this->geotnt) { |
|
453 | 453 | $pathToGeoIndex = $this->geotnt->config['storage']."/{$indexName}.index"; |
454 | 454 | if (file_exists($pathToGeoIndex)) { |
455 | 455 | unlink($pathToGeoIndex); |