module Stretchie::Pants

Public Instance Methods

delete_from_index() click to toggle source

Delete the document from the ElasticSearch index

# File lib/stretchie/pants.rb, line 29
def delete_from_index
  begin
    __elasticsearch__.delete_document
  rescue Elasticsearch::Transport::Transport::Errors::NotFound
    nil
  end

  index_dependent_models.map(&:update_in_index)
end
index_dependent_models() click to toggle source

Override to trigger dependent models to be re-indexed, should return an array of models to run .update_in_index on.

# File lib/stretchie/pants.rb, line 42
def index_dependent_models
  []
end
update_in_index() click to toggle source

Update the document in the ElasticSearch index

# File lib/stretchie/pants.rb, line 21
def update_in_index
  __elasticsearch__.index_document

  index_dependent_models.map(&:update_in_index)
end