module CustomAttributes::Searchable

Public Class Methods

handle_search_connection_error(exception) click to toggle source

default connection error handling, override in model!

# File lib/custom_attributes/concerns/searchable.rb, line 45
def self.handle_search_connection_error(exception)
  raise exception
end
searchable() click to toggle source

entrypoint for the fluent query builder

# File lib/custom_attributes/concerns/searchable.rb, line 40
def self.searchable
  CustomAttributes::FluentSearchQuery.new new
end

Public Instance Methods

delete_document_or_fail() click to toggle source
# File lib/custom_attributes/concerns/searchable.rb, line 57
def delete_document_or_fail
  __elasticsearch__.delete_document
rescue Faraday::ConnectionFailed => e
  self.class.handle_search_connection_error(e)
end
index_document_or_fail() click to toggle source
# File lib/custom_attributes/concerns/searchable.rb, line 51
def index_document_or_fail
  __elasticsearch__.index_document
rescue Faraday::ConnectionFailed => e
  self.class.handle_search_connection_error(e)
end