1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-11-19 11:29:17 +00:00

[#477] Minor refactoring (user search query).

This commit is contained in:
Ivan Tashkinov 2019-01-16 10:44:32 +03:00
parent 5b8f9ff8c1
commit 0bc6d30f7d

View file

@ -702,12 +702,14 @@ def search(query, resolve \\ false, for_user \\ nil) do
fragment(
"""
ts_rank_cd(
setweight(to_tsvector('simple', regexp_replace(nickname, '\\W', ' ', 'g')), 'A') ||
setweight(to_tsvector('simple', regexp_replace(coalesce(name, ''), '\\W', ' ', 'g')), 'B'),
setweight(to_tsvector('simple', regexp_replace(?, '\\W', ' ', 'g')), 'A') ||
setweight(to_tsvector('simple', regexp_replace(coalesce(?, ''), '\\W', ' ', 'g')), 'B'),
to_tsquery('simple', ?),
32
)
""",
u.nickname,
u.name,
^processed_query
)
},