Skip to content

NOW MANAGED ON CODEBERG

Fixed search query issues when table prefixes are used

Dan Brown81d6b1b016bd
diff --git a/app/Entities/Tools/SearchRunner.php b/app/Entities/Tools/SearchRunner.php
index 8e18408bd..ca592755b 100644
--- a/app/Entities/Tools/SearchRunner.php
+++ b/app/Entities/Tools/SearchRunner.php
@@ -156,7 +156,9 @@ class SearchRunner
})->groupBy('entity_type', 'entity_id');
$entitySelect->join($this->db->raw('(' . $subQuery->toSql() . ') as s'), function (JoinClause $join) {
$join->on('id', '=', 'entity_id');
- })->selectRaw($entity->getTable() . '.*, s.score')->orderBy('score', 'desc');
+ })->addSelect($entity->getTable() . '.*')
+ ->selectRaw('s.score')
+ ->orderBy('score', 'desc');
$entitySelect->mergeBindings($subQuery);
}