module Srchio::Concern

Public Instance Methods

srch_destroy() click to toggle source

srch_destroy: Deletes the document from your searcher. Best used in an after_filter.

end

# File lib/srchio/concern.rb, line 34
def srch_destroy
        self.class.srch_destroy(:remote_id => srch_send(:remote_id))
end
srch_save() click to toggle source

srch_save: Sends the document to your searcher. Could be used as an after_filter or in a job.

end

# File lib/srchio/concern.rb, line 12
def srch_save
        doc = {
                :body => srch_send(:body),
                :title => srch_send(:title),
                :url => srch_send(:url),
                :remote_id => srch_send(:remote_id)
        }
        
        if self.class.srch_config.keys.include?(:tags)
                doc[:tags] = srch_send(:tags)
        end
        
        if self.class.srch_config.keys.include?(:created)
                doc[:created] = srch_send(:created)
        end
        
        self.class.srch_add(doc)
end
srch_send(key) click to toggle source
# File lib/srchio/concern.rb, line 38
def srch_send(key)
        self.send(self.class.srch_config[key])
end