Skip to content

Commit

Permalink
https://github.com/bonfire-networks/bonfire-app/issues/765
Browse files Browse the repository at this point in the history
  • Loading branch information
mayel committed Jan 15, 2024
1 parent b4d678b commit f8774a4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/users/users_queries.ex
Expand Up @@ -52,11 +52,22 @@ defmodule Bonfire.Me.Users.Queries do
[profile: p, character: c],
ilike(p.name, ^"#{text}%") or
ilike(p.name, ^"% #{text}%") or
ilike(p.summary, ^"#{text}%") or
ilike(p.summary, ^"% #{text}%") or
ilike(c.username, ^"#{text}%") or
ilike(c.username, ^"% #{text}%")
)
|> prepend_order_by([profile: p, character: c], [
{:desc, fragment("(? <% ?)::int + (? <% ?)::int", ^text, c.username, ^text, p.name)}
{:desc,
fragment(
"(? <% ?)::int + (? <% ?)::int + (? <% ?)::int",
^text,
c.username,
^text,
p.name,
^text,
p.summary
)}
])
end

Expand Down

0 comments on commit f8774a4

Please sign in to comment.