You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$builder->whereHas('organisations', function ($query) use ($society) {
@@ -219,25 +214,12 @@ public function queryUsers(UserQuery $userQuery): Builder
219
214
}
220
215
221
216
if (in_array($userQuery->getOrderBy(), ['first_name', 'last_name', 'organisation', 'industry_type'])) {
222
-
$builder->orderByRaw('(SELECT ' . $userQuery->getOrderBy() . ' FROM user_profiles WHERE user_profiles.user_id = users.id AND user_profiles.deleted_at IS NULL ORDER BY user_profiles.id DESC LIMIT 1) ' . $userQuery->getSort());
217
+
$builder->orderByRaw('(SELECT ' . $userQuery->getOrderBy() . ' FROM user_profiles WHERE user_profiles.user_id = users.id) ' . $userQuery->getSort());
$profileMatch = 'MATCH(user_profiles.first_name, user_profiles.last_name, user_profiles.organisation) AGAINST (? IN NATURAL LANGUAGE MODE)';
231
-
$emailMatch = 'MATCH(users.email) AGAINST (? IN NATURAL LANGUAGE MODE)';
232
-
$profileScore = "(SELECT {$profileMatch} FROM user_profiles WHERE user_profiles.user_id = users.id AND user_profiles.deleted_at IS NULL ORDER BY user_profiles.id DESC LIMIT 1)";
->selectRaw("{$score} as search_score", [$search, $search])
237
-
->whereRaw("({$emailMatch} > 0 OR EXISTS (SELECT 1 FROM user_profiles WHERE user_profiles.user_id = users.id AND user_profiles.deleted_at IS NULL AND {$profileMatch} > 0))", [$search, $search])
0 commit comments