|
@ -436,7 +436,7 @@ class Account < ApplicationRecord |
|
|
accounts.*, |
|
|
accounts.*, |
|
|
(count(f.id) + 1) * ts_rank_cd(#{textsearch}, #{query}, 32) AS rank |
|
|
(count(f.id) + 1) * ts_rank_cd(#{textsearch}, #{query}, 32) AS rank |
|
|
FROM accounts |
|
|
FROM accounts |
|
|
LEFT OUTER JOIN follows AS f ON (accounts.id = f.account_id AND f.target_account_id = ?) OR (accounts.id = f.target_account_id AND f.account_id = ?) |
|
|
|
|
|
|
|
|
LEFT OUTER JOIN follows AS f ON (accounts.id = f.account_id AND f.target_account_id = ?) |
|
|
WHERE accounts.id IN (SELECT * FROM first_degree) |
|
|
WHERE accounts.id IN (SELECT * FROM first_degree) |
|
|
AND #{query} @@ #{textsearch} |
|
|
AND #{query} @@ #{textsearch} |
|
|
AND accounts.suspended_at IS NULL |
|
|
AND accounts.suspended_at IS NULL |
|
@ -446,7 +446,7 @@ class Account < ApplicationRecord |
|
|
LIMIT ? OFFSET ? |
|
|
LIMIT ? OFFSET ? |
|
|
SQL |
|
|
SQL |
|
|
|
|
|
|
|
|
records = find_by_sql([sql, account.id, account.id, account.id, account.id, limit, offset]) |
|
|
|
|
|
|
|
|
records = find_by_sql([sql, account.id, account.id, account.id, limit, offset]) |
|
|
else |
|
|
else |
|
|
sql = <<-SQL.squish |
|
|
sql = <<-SQL.squish |
|
|
SELECT |
|
|
SELECT |
|
|