Class: Sunspot::DSL::FieldStats

Inherits:
Object
  • Object
show all
Defined in:
lib/sunspot/dsl/field_stats.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(query_stats, setup, search_stats) ⇒ FieldStats

:nodoc:



4
5
6
# File 'lib/sunspot/dsl/field_stats.rb', line 4

def initialize(query_stats, setup, search_stats) #:nodoc:
  @query_stats, @setup, @search_stats = query_stats, setup, search_stats
end

Instance Method Details

#facet(*field_names) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/sunspot/dsl/field_stats.rb', line 8

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