[#477] Minor refactoring (user search query).
authorIvan Tashkinov <ivantashkinov@gmail.com>
Wed, 16 Jan 2019 07:44:32 +0000 (10:44 +0300)
committerIvan Tashkinov <ivantashkinov@gmail.com>
Wed, 16 Jan 2019 07:44:32 +0000 (10:44 +0300)
lib/pleroma/user.ex

index 2488697bb3bf217d362903ff022f3beab392850f..8ae36416a761fb388e0beebef76cbaf2dcdc359f 100644 (file)
@@ -702,12 +702,14 @@ defmodule Pleroma.User 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
             )
         },