Sha256: 5d661100a1b78f1a44b5d52ae071c93a5e236adadb89d6eec3474e59591d496f

Contents?: true

Size: 572 Bytes

Versions: 25

Compression:

Stored size: 572 Bytes

Contents

module Elastics
  class Result
    module MultiGet

      # extend if result comes from a search url
      def self.should_extend?(result)
        result.response.url =~ /\b_mget\b/ && result['docs']
      end

      # extend the hits results on extended
      def self.extended(result)
        result['docs'].each { |h| h.extend(Document) }
        result['docs'].extend Struct::Paginable
        result['docs'].setup(result['docs'].size, result.variables)
      end

      def docs
        self['docs']
      end
      alias_method :collection, :docs

    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
elastics-client-1.3.3 lib/elastics/result/multi_get.rb
elastics-client-1.3.2 lib/elastics/result/multi_get.rb
elastics-client-1.3.1 lib/elastics/result/multi_get.rb
elastics-client-1.3.0 lib/elastics/result/multi_get.rb
elastics-client-1.2.1 lib/elastics/result/multi_get.rb
elastics-client-1.2.0 lib/elastics/result/multi_get.rb
elastics-client-1.1.11 lib/elastics/result/multi_get.rb
elastics-client-1.1.10 lib/elastics/result/multi_get.rb
elastics-client-1.1.9 lib/elastics/result/multi_get.rb
elastics-client-1.1.8 lib/elastics/result/multi_get.rb
elastics-client-1.1.7 lib/elastics/result/multi_get.rb
elastics-client-1.1.6 lib/elastics/result/multi_get.rb
elastics-client-1.1.5 lib/elastics/result/multi_get.rb
elastics-client-1.1.4 lib/elastics/result/multi_get.rb
elastics-client-1.1.3 lib/elastics/result/multi_get.rb
elastics-client-1.1.2 lib/elastics/result/multi_get.rb
elastics-client-1.1.1 lib/elastics/result/multi_get.rb
elastics-client-1.1.0 lib/elastics/result/multi_get.rb
elastics-client-1.0.10 lib/elastics/result/multi_get.rb
elastics-client-1.0.9 lib/elastics/result/multi_get.rb