Upstream sync
This commit was merged in pull request #1.
This commit is contained in:
@@ -42,14 +42,17 @@ module PgSearchable
|
||||
|
||||
def ts_add_scope
|
||||
class_eval do
|
||||
scope ts_scope_method, ->(value) { ts_search(value) }
|
||||
scope ts_scope_method, ->(value) do
|
||||
resulting_ids = ts_search(value).map(&:id)
|
||||
where(id: resulting_ids)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def ts_search(value)
|
||||
return if @ts_search_fields.blank? || value.blank?
|
||||
includes(@ts_joins).references(:all).where(
|
||||
TextToSqlQuery.new(value, @ts_search_fields, @default_field, @ts_search_fields_mappings).where_clause)
|
||||
TextToSqlQuery.new(value, @ts_search_fields, @default_field, @ts_search_fields_mappings).where_clause).distinct
|
||||
end
|
||||
|
||||
def should_update_cache_field?
|
||||
|
||||
Reference in New Issue
Block a user