Skip to content

Commit

Permalink
🐛 fixing teamtnt/tntsearch#55
Browse files Browse the repository at this point in the history
  • Loading branch information
it4need committed Jul 29, 2022
1 parent dd36a06 commit e760ee7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@
"email": "[email protected]"
}
],
"repositories": [
{
"url": "https://github.com/Duplexmedia/tntsearch.git",
"type": "vcs"
}
],
"require": {
"php": ">=7.1|^8",
"teamtnt/tntsearch": "2.7.0|^2.8",
"teamtnt/tntsearch": "dev-forked",
"laravel/scout": "7.*|^8.0|^8.3|^9.0",
"illuminate/bus": "~5.4|^6.0|^7.0|^8.0|^9.0",
"illuminate/contracts": "~5.4|^6.0|^7.0|^8.0|^9.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Engines/TNTSearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ public function map(Builder $builder, $results, $model)
}

// sort models by tnt search result set
return $model->newCollection(collect($results['ids'])->map(function ($hit) use ($models) {
return $model->newCollection(collect($results['ids'])->map(function ($hit, $key) use ($models, $results) {
if (isset($models[$hit])) {
return $models[$hit];
return $models[$hit]->setAttribute('__tntSearchScore__', $results['docScores'][$hit]);
}
})->filter()->all());
}
Expand Down

0 comments on commit e760ee7

Please sign in to comment.