aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/user.ex13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index eb4218ebe..87815e11c 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -734,7 +734,16 @@ defmodule Pleroma.User do
^processed_query
)
},
- where: not is_nil(u.nickname)
+ where:
+ fragment(
+ """
+ (setweight(to_tsvector('simple', regexp_replace(?, '\\W', ' ', 'g')), 'A') ||
+ setweight(to_tsvector('simple', regexp_replace(coalesce(?, ''), '\\W', ' ', 'g')), 'B')) @@ to_tsquery('simple', ?)
+ """,
+ u.nickname,
+ u.name,
+ ^processed_query
+ )
)
end
@@ -750,7 +759,7 @@ defmodule Pleroma.User do
u.name
)
},
- where: not is_nil(u.nickname)
+ where: fragment("trim(? || ' ' || coalesce(?, '')) % ?", u.nickname, u.name, ^query)
)
end