Sha256: 68335efdf110ef035e6e8719f266f34e1e5cf23cfa4b26731c6089cc2bf8506d

Contents?: true

Size: 739 Bytes

Versions: 13

Compression:

Stored size: 739 Bytes

Contents

module Elasticsearch
  module Model
    module Response

      # Encapsulates the collection of documents returned from Elasticsearch
      #
      # Implements Enumerable and forwards its methods to the {#results} object.
      #
      class Results
        include Base
        include Enumerable

        delegate :each, :empty?, :size, :slice, :[], :to_a, :to_ary, to: :results

        # @see Base#initialize
        #
        def initialize(klass, response, options={})
          super
        end

        # Returns the {Results} collection
        #
        def results
          # TODO: Configurable custom wrapper
          response.response['hits']['hits'].map { |hit| Result.new(hit) }
        end

      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
elasticsearch-model-6.1.2 lib/elasticsearch/model/response/results.rb
elasticsearch-model-6.1.1 lib/elasticsearch/model/response/results.rb
elasticsearch-model-6.1.0 lib/elasticsearch/model/response/results.rb
elasticsearch-model-6.0.0 lib/elasticsearch/model/response/results.rb
elasticsearch-model-6.0.0.pre lib/elasticsearch/model/response/results.rb
elasticsearch-model-5.1.0 lib/elasticsearch/model/response/results.rb
elasticsearch-model-5.0.2 lib/elasticsearch/model/response/results.rb
elasticsearch-model-2.0.1 lib/elasticsearch/model/response/results.rb
elasticsearch-model-5.0.1 lib/elasticsearch/model/response/results.rb
elasticsearch-model-2.0.0 lib/elasticsearch/model/response/results.rb
elasticsearch-model-5.0.0 lib/elasticsearch/model/response/results.rb
elasticsearch-model-0.1.9 lib/elasticsearch/model/response/results.rb
elasticsearch-model-0.1.8 lib/elasticsearch/model/response/results.rb