Sha256: 79ce7df1a017155ca32908e4d72206bb9a05a1ff8ddcb1d64138d452340019c1

Contents?: true

Size: 1.01 KB

Versions: 27

Compression:

Stored size: 1.01 KB

Contents

require 'sunspot/search/hit_enumerable'

module Sunspot
  module Search
    class Group
      attr_reader :value

      include HitEnumerable

      def initialize(value, doclist, search)
        @value, @doclist, @search = value, doclist, search
      end

      def hits(options = {})
        if options[:verify]
          super
        else
          @hits ||= super
        end
      end

      def verified_hits
        @verified_hits ||= super
      end

      def results
        @results ||= verified_hits.map { |hit| hit.instance }
      end

      def highlights_for(doc)
        @search.highlights_for(doc)
      end

      def solr_docs
        @doclist['docs']
      end
      
      def data_accessor_for(clazz)
        @search.data_accessor_for(clazz)
      end      
      
      #
      # The total number of documents matching the query for this group
      #
      # ==== Returns
      #
      # Integer:: Total matching documents
      # 
      def total
        @doclist['numFound']
      end      
    end
  end
end

Version data entries

27 entries across 27 versions & 4 rubygems

Version Path
sunspot-2.7.1 lib/sunspot/search/group.rb
sunspot-2.7.0 lib/sunspot/search/group.rb
sunspot-2.6.0 lib/sunspot/search/group.rb
sunspot-2.5.0 lib/sunspot/search/group.rb
sunspot-2.4.0 lib/sunspot/search/group.rb
sunspot-2.3.0 lib/sunspot/search/group.rb
sunspot-2.2.8 lib/sunspot/search/group.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sunspot-2.2.7/lib/sunspot/search/group.rb
sunspot-2.2.7 lib/sunspot/search/group.rb
sunspot-2.2.6 lib/sunspot/search/group.rb
sunspot-2.2.5 lib/sunspot/search/group.rb
sunspot-2.2.4 lib/sunspot/search/group.rb
sunspot-2.2.3 lib/sunspot/search/group.rb
sunspot-2.2.2 lib/sunspot/search/group.rb
sunspot-2.2.1 lib/sunspot/search/group.rb
sunspot-2.2.0 lib/sunspot/search/group.rb
sunspot-2.1.1 lib/sunspot/search/group.rb
sunspot-2.1.0 lib/sunspot/search/group.rb
sunspot-2.0.0 lib/sunspot/search/group.rb
sunspot-2.0.0.pre.130115 lib/sunspot/search/group.rb