Sha256: 7772bf03b56421a51bf300cf606cd337d80e55d9b84cc1aaa97537234a0576fb

Contents?: true

Size: 674 Bytes

Versions: 9

Compression:

Stored size: 674 Bytes

Contents

module Sunspot
  module Search
    class FieldGroup
      def initialize(field, search, options) #:nodoc:
        @field, @search, @options = field, search, options
      end

      def groups
        @groups ||=
          begin
            if solr_response
              solr_response['groups'].map do |group|
                Group.new(group['groupValue'], group['doclist'], @search)
              end
            end
          end
      end

      def matches
        if solr_response
          solr_response['matches'].to_i
        end
      end

      private

      def solr_response
        @search.group_response[@field.indexed_name.to_s]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
gojee-sunspot-2.0.5 lib/sunspot/search/field_group.rb
gojee-sunspot-2.0.4 lib/sunspot/search/field_group.rb
gojee-sunspot-2.0.2 lib/sunspot/search/field_group.rb
erichummel-sunspot-2.0.0.pre.111215d lib/sunspot/search/field_group.rb
erichummel-sunspot-2.0.0.pre.111215c lib/sunspot/search/field_group.rb
erichummel-sunspot-2.0.0.pre.111215b lib/sunspot/search/field_group.rb
erichummel-sunspot-2.0.0.pre.111215a lib/sunspot/search/field_group.rb
erichummel-sunspot-2.0.0.pre.111215 lib/sunspot/search/field_group.rb
sunspot-2.0.0.pre.111215 lib/sunspot/search/field_group.rb