projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into issue/1276
[akkoma]
/
lib
/
pleroma
/
user
/
search.ex
diff --git
a/lib/pleroma/user/search.ex
b/lib/pleroma/user/search.ex
index bab8d92e2be299f78101a209219fdb7d4f6a31ab..09664db76b7393a144c9d54972ba3a884eabb7bf 100644
(file)
--- a/
lib/pleroma/user/search.ex
+++ b/
lib/pleroma/user/search.ex
@@
-54,15
+54,7
@@
defmodule Pleroma.User.Search do
|> maybe_restrict_local(for_user)
end
|> maybe_restrict_local(for_user)
end
- @nickname_regex ~r/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~\-@]+$/
defp fts_search(query, query_string) do
defp fts_search(query, query_string) do
- {nickname_weight, name_weight} =
- if String.match?(query_string, @nickname_regex) do
- {"A", "B"}
- else
- {"B", "A"}
- end
-
query_string = to_tsquery(query_string)
from(
query_string = to_tsquery(query_string)
from(
@@
-70,12
+62,10
@@
defmodule Pleroma.User.Search do
where:
fragment(
"""
where:
fragment(
"""
- (
setweight(to_tsvector('simple', ?), ?) || setweight(to_tsvector('simple', ?)
, ?)) @@ to_tsquery('simple', ?)
+ (
to_tsvector('simple', ?) || to_tsvector('simple'
, ?)) @@ to_tsquery('simple', ?)
""",
u.name,
""",
u.name,
- ^name_weight,
u.nickname,
u.nickname,
- ^nickname_weight,
^query_string
)
)
^query_string
)
)