Commit 0bc6d30f authored by Ivan Tashkinov's avatar Ivan Tashkinov
Browse files

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

parent 5b8f9ff8
...@@ -702,12 +702,14 @@ def search(query, resolve \\ false, for_user \\ nil) do ...@@ -702,12 +702,14 @@ def search(query, resolve \\ false, for_user \\ nil) do
fragment( fragment(
""" """
ts_rank_cd( ts_rank_cd(
setweight(to_tsvector('simple', regexp_replace(nickname, '\\W', ' ', 'g')), 'A') || setweight(to_tsvector('simple', regexp_replace(?, '\\W', ' ', 'g')), 'A') ||
setweight(to_tsvector('simple', regexp_replace(coalesce(name, ''), '\\W', ' ', 'g')), 'B'), setweight(to_tsvector('simple', regexp_replace(coalesce(?, ''), '\\W', ' ', 'g')), 'B'),
to_tsquery('simple', ?), to_tsquery('simple', ?),
32 32
) )
""", """,
u.nickname,
u.name,
^processed_query ^processed_query
) )
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment