diff --git a/composer.json b/composer.json index 7a18f26..9d6770c 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ ], "require": { "php": ">=7.1|^8", - "teamtnt/tntsearch": "2.7.0|^2.8|^3.0|^4.0", + "teamtnt/tntsearch": "2.7.0|^2.8|^3.0|^4.0|^5.0", "laravel/scout": "7.*|^8.0|^8.3|^9.0|^10", "illuminate/bus": "~5.4|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", "illuminate/contracts": "~5.4|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", diff --git a/src/Engines/TNTSearchEngine.php b/src/Engines/TNTSearchEngine.php index 1e02e35..2ae8178 100644 --- a/src/Engines/TNTSearchEngine.php +++ b/src/Engines/TNTSearchEngine.php @@ -61,7 +61,7 @@ public function update($models) if (method_exists($model, 'shouldBeSearchable') && ! $model->shouldBeSearchable()) { return; } - + $array = $model->toSearchableArray(); if (empty($array)) { @@ -202,6 +202,8 @@ public function map(Builder $builder, $results, $model) return $model->newCollection([]); } + $this->builder = $builder; + $keys = collect($results['ids'])->values()->all(); $builder = $this->getBuilder($model); @@ -245,6 +247,8 @@ public function lazyMap(Builder $builder, $results, $model) return LazyCollection::make(); } + $this->builder = $builder; + $keys = collect($results['ids'])->values()->all(); $builder = $this->getBuilder($model); diff --git a/src/TNTSearchScoutServiceProvider.php b/src/TNTSearchScoutServiceProvider.php index 9a48bd1..c426db0 100644 --- a/src/TNTSearchScoutServiceProvider.php +++ b/src/TNTSearchScoutServiceProvider.php @@ -27,7 +27,7 @@ public function boot() $tnt->loadConfig($config); $tnt->setDatabaseHandle(app('db')->connection()->getPdo()); - $tnt->maxDocs = config('scout.tntsearch.maxDocs', 500); + $tnt->engine->maxDocs = config('scout.tntsearch.maxDocs', 500); $this->setFuzziness($tnt); $this->setAsYouType($tnt);