Ensure the mentioning scope search works
Include the filter by accessible board ids to avoid large joins from the search_index table. Drop the unused search scope.
This commit is contained in:
committed by
Mike Dalessio
parent
a41085fe00
commit
ddd7fe082a
@@ -5,18 +5,6 @@ module Searchable
|
||||
after_create_commit :create_in_search_index
|
||||
after_update_commit :update_in_search_index
|
||||
after_destroy_commit :remove_from_search_index
|
||||
|
||||
scope :search, ->(query) do
|
||||
query = Search::Query.wrap(query)
|
||||
|
||||
base = joins("INNER JOIN search_index ON search_index.searchable_type = '#{name}' AND search_index.searchable_id = #{table_name}.id")
|
||||
|
||||
if query.valid?
|
||||
base.where("MATCH(search_index.content, search_index.title) AGAINST(? IN BOOLEAN MODE)", query.to_s)
|
||||
else
|
||||
base.none
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def reindex
|
||||
|
||||
Reference in New Issue
Block a user