module SearchEnjoy::Indexing::InstanceMethods
Public Instance Methods
as_indexed_json()
click to toggle source
For default execute methods with attributes name
# File lib/search_enjoy/indexing.rb, line 48 def as_indexed_json schema = self.class.index_schema hash = {} schema.key_map.each do |key| hash[key.name.to_sym] = send(key.name) end hash end
index_object()
click to toggle source
# File lib/search_enjoy/indexing.rb, line 60 def index_object raise IndexException, 'Index doesnt exist' if self.class.search_index.nil? indexed_object = self.class.index_schema.call(as_indexed_json) return if indexed_object.errors.messages.size > 0 self.class.search_index[id.to_s.to_sym] = indexed_object Thread.new do self.class.increase_dump_counter self.class.dump_index_to_file if self.class.need_dump? end.join indexed_object rescue StandardError => e e.message end