@@ -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 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($geoindex) { |
66 | 66 | $geoindex->indexBeginTransaction(); |
67 | 67 | } |
68 | - $models->each(function ($model) use ($index, $geoindex) { |
|
68 | + $models->each(function($model) use ($index, $geoindex) { |
|
69 | 69 | $array = $model->toSearchableArray(); |
70 | 70 | |
71 | 71 | if (empty($array)) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | public function delete($models) |
103 | 103 | { |
104 | 104 | $this->initIndex($models->first()); |
105 | - $models->each(function ($model) { |
|
105 | + $models->each(function($model) { |
|
106 | 106 | $this->tnt->selectIndex("{$model->searchableAs()}.index"); |
107 | 107 | $index = $this->tnt->getIndex(); |
108 | 108 | $index->setPrimaryKey($model->getKeyName()); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | // sort models by tnt search result set |
249 | - return collect($results['ids'])->map(function ($hit) use ($models) { |
|
249 | + return collect($results['ids'])->map(function($hit) use ($models) { |
|
250 | 250 | if (isset($models[$hit])) { |
251 | 251 | return $models[$hit]; |
252 | 252 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | $discardIds = $builder->model->newQuery() |
343 | 343 | ->select($qualifiedKeyName) |
344 | - ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '. $builder->model->getConnection()->getTablePrefix() .'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
344 | + ->leftJoin(DB::raw('('.$sub->getQuery()->toSql().') as '.$builder->model->getConnection()->getTablePrefix().'sub'), $subQualifiedKeyName, '=', $qualifiedKeyName) |
|
345 | 345 | ->addBinding($sub->getQuery()->getBindings(), 'join') |
346 | 346 | ->whereIn($qualifiedKeyName, $searchResults) |
347 | 347 | ->whereNull($subQualifiedKeyName) |
@@ -412,10 +412,10 @@ discard block |
||
412 | 412 | private function applyWheres($builder) |
413 | 413 | { |
414 | 414 | // iterate over given where clauses |
415 | - return collect($this->builder->wheres)->map(function ($value, $key) { |
|
415 | + return collect($this->builder->wheres)->map(function($value, $key) { |
|
416 | 416 | // for reduce function combine key and value into array |
417 | 417 | return [$key, $value]; |
418 | - })->reduce(function ($builder, $where) { |
|
418 | + })->reduce(function($builder, $where) { |
|
419 | 419 | // separate key, value again |
420 | 420 | list($key, $value) = $where; |
421 | 421 | return $builder->where($key, $value); |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | private function applyOrders($builder) |
432 | 432 | { |
433 | 433 | //iterate over given orderBy clauses - should be only one |
434 | - return collect($this->builder->orders)->map(function ($value, $key) { |
|
434 | + return collect($this->builder->orders)->map(function($value, $key) { |
|
435 | 435 | // for reduce function combine key and value into array |
436 | 436 | return [$value["column"], $value["direction"]]; |
437 | - })->reduce(function ($builder, $orderBy) { |
|
437 | + })->reduce(function($builder, $orderBy) { |
|
438 | 438 | // separate key, value again |
439 | 439 | list($column, $direction) = $orderBy; |
440 | 440 | return $builder->orderBy($column, $direction); |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | unlink($pathToIndex); |
456 | 456 | } |
457 | 457 | |
458 | - if ($this->geotnt){ |
|
458 | + if ($this->geotnt) { |
|
459 | 459 | $pathToGeoIndex = $this->geotnt->config['storage']."/{$indexName}.index"; |
460 | 460 | if (file_exists($pathToGeoIndex)) { |
461 | 461 | unlink($pathToGeoIndex); |