Sha256: 4f54281c99a3d2a75e7b2a0aaeb065273d0568ebc0ca445f5a82726b8e3c895c

Contents?: true

Size: 666 Bytes

Versions: 6

Compression:

Stored size: 666 Bytes

Contents

module Sunspot
  module DSL
    class FieldStats #:nodoc:
      def initialize(query_stats, setup, search_stats) #:nodoc:
        @query_stats, @setup, @search_stats = query_stats, setup, search_stats
      end

      def facet *field_names
        field_names.each do |field_name|
          field = @setup.field(field_name)

          @query_stats.add_facet(field)
          @search_stats.add_facet(field)
        end
      end

      def json_facet(field_name, options = {})
        field = @setup.field(field_name)
        facet = Sunspot::Util.parse_json_facet(field_name, options, @setup)
        @query_stats.add_json_facet(facet)
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sunspot-2.7.1 lib/sunspot/dsl/field_stats.rb
sunspot-2.7.0 lib/sunspot/dsl/field_stats.rb
sunspot-2.6.0 lib/sunspot/dsl/field_stats.rb
sunspot-2.5.0 lib/sunspot/dsl/field_stats.rb
sunspot-2.4.0 lib/sunspot/dsl/field_stats.rb
sunspot-2.3.0 lib/sunspot/dsl/field_stats.rb