Sha256: 113efc8595367001b699a9f4719a2c9d4df66208552ffa262dd2fa130f7e802e
Contents?: true
Size: 963 Bytes
Versions: 1
Compression:
Stored size: 963 Bytes
Contents
require "es_searchable/version" require "es_searchable/configurable" module EsSearchable extend Configurable extend ActiveSupport::Concern included do class << self delegate *SearchMethods, to: :es_collection, prefix: :es end end module ClassMethods def es_collection SearchCollection.new(self) end def handle_es_response(es_coll) es_coll end def client @client ||= Elasticsearch::Client.new(EsSearchable.options.slice( :log, :retry_on_failure, :reload_on_failure, :hosts, :logger )) end def es_search(conditions) client.search(index: index, body: conditions) end def es_index(index) @index = index end def index @index ||= self.name.demodulize.downcase.pluralize end def method_missing(meth, *args, &blk) case meth when /(.*)_(gt|lt|gte|lte|between|like)/ es_collection.send(meth, *args, &blk) else super end end end end require "es_searchable/search_collection"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
es_searchable-0.1.1 | lib/es_searchable.rb |