Completed
Pull Request — master (#186)
by
unknown
09:03
created
src/TNTSearchScoutServiceProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -43,6 +43,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Engines/TNTSearchEngine.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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());
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 
115 115
         $searchResults = $results['ids'];
116 116
 
117
-        $qualifiedKeyName = $builder->model->getQualifiedKeyName();  // tableName.id
118
-        $subQualifiedKeyName = 'sub.' . $builder->model->getKeyName(); // sub.id
117
+        $qualifiedKeyName = $builder->model->getQualifiedKeyName(); // tableName.id
118
+        $subQualifiedKeyName = 'sub.'.$builder->model->getKeyName(); // sub.id
119 119
     
120 120
         $sub = $this->getBuilder($builder->model)->whereIn(
121 121
             $qualifiedKeyName, $searchResults
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     protected function filters(Builder $builder)
208 208
     {
209
-        return collect($builder->wheres)->map(function ($value, $key) {
209
+        return collect($builder->wheres)->map(function($value, $key) {
210 210
             return $key.'='.$value;
211 211
         })->values()->all();
212 212
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         }
240 240
 
241 241
         // sort models by tnt search result set
242
-        return collect($results['ids'])->map(function ($hit) use ($models) {
242
+        return collect($results['ids'])->map(function($hit) use ($models) {
243 243
             if (isset($models[$hit])) {
244 244
                 return $models[$hit];
245 245
             }
@@ -260,20 +260,20 @@  discard block
 block discarded – undo
260 260
         $builder = isset($this->builder->constraints) ? $this->builder->constraints : $model->newQuery();
261 261
 
262 262
         // iterate over given where clauses
263
-        $builder = collect($this->builder->wheres)->map(function ($value, $key) {
263
+        $builder = collect($this->builder->wheres)->map(function($value, $key) {
264 264
             // for reduce function combine key and value into array
265 265
             return [$key, $value];
266
-        })->reduce(function ($builder, $where) {
266
+        })->reduce(function($builder, $where) {
267 267
             // separate key, value again
268 268
             list($key, $value) = $where;
269 269
             return $builder->where($key, $value);
270 270
         }, $builder);
271 271
 
272 272
         //iterate over given orderBy clauses - should be only one
273
-        return collect($this->builder->orders)->map(function ($value, $key) {
273
+        return collect($this->builder->orders)->map(function($value, $key) {
274 274
             // for reduce function combine key and value into array
275 275
             return [$value["column"], $value["direction"]];
276
-        })->reduce(function ($builder, $orderBy) {
276
+        })->reduce(function($builder, $orderBy) {
277 277
             // separate key, value again
278 278
             list($column, $direction) = $orderBy;
279 279
             return $builder->orderBy($column, $direction);
Please login to merge, or discard this patch.