Search documents with blank content
vanboom opened this issue · comments
Don commented
It is possible for the user to reference an attribute or attributes for multisearchable
that contains no data. If there is no data for the content
of the pg_search_document, a record is created anyway.
Suggestion - it may be more efficient to not create a pg_search_document record when there is no searchable data to be stored.
pg_search/lib/pg_search/multisearchable.rb
Lines 57 to 63 in d6064dc
Don commented
A work around exists using the if
feature...
multisearchable :against=>[:serial_number, :model_number], if: :has_multisearchable?
def has_multisearchable?
serial_number.present? or model_number.present?
end