Merge pull request #1674 from basecamp/search-with-tenant-key

Search with the tenant key
This commit is contained in:
Donal McBreen
2025-11-21 11:20:56 +00:00
committed by GitHub
+3 -1
View File
@@ -44,7 +44,9 @@ class Search::Record < ApplicationRecord
end
scope :matching, ->(query, account_id) do
where("MATCH(#{table_name}.account_key, #{table_name}.content, #{table_name}.title) AGAINST(? IN BOOLEAN MODE)", query)
account_key = "account#{account_id}"
full_query = "+#{account_key} +(#{query})"
where("MATCH(#{table_name}.account_key, #{table_name}.content, #{table_name}.title) AGAINST(? IN BOOLEAN MODE)", full_query)
end
scope :for_user, ->(user) do