Sha256: d6bca4c12ecdf44a66d6f5501d1b298fcf30bc5086dcd9ab1510c068a0a040e5

Contents?: true

Size: 929 Bytes

Versions: 19

Compression:

Stored size: 929 Bytes

Contents

module Sunspot
  module DSL
    # 
    # This tiny DSL class implements the DSL for the FieldQuery.facet
    # method.
    #
    class QueryFacet
      def initialize(query_facet) #:nodoc:
        @query_facet = query_facet
      end

      # 
      # Add a row to this query facet. The label argument can be anything; it's
      # simply the value that's passed into the Sunspot::QueryFacetRow object
      # corresponding to the row that's created. Use whatever seems most
      # intuitive.
      #
      # The block is evaluated in the context of a Sunspot::DSL::Scope, meaning
      # any restrictions can be placed on the documents matching this facet row.
      #
      # ==== Parameters
      #
      # label<Object>::
      #   An object used to identify this facet row in the results.
      #
      def row(label, &block)
        Scope.new(@query_facet.add_row(label)).instance_eval(&block)
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 7 rubygems

Version Path
Chrononaut-sunspot-client-0.9.4 lib/sunspot/dsl/query_facet.rb
UnderpantsGnome-sunspot-0.9.1.1 lib/sunspot/dsl/query_facet.rb
UnderpantsGnome-sunspot-0.9.8.1 lib/sunspot/dsl/query_facet.rb
benjaminkrause-sunspot-0.9.7 lib/sunspot/dsl/query_facet.rb
benjaminkrause-sunspot-0.9.8 lib/sunspot/dsl/query_facet.rb
kristopher-sunspot-0.9.8 lib/sunspot/dsl/query_facet.rb
kuahyeow-sunspot-0.9.7 lib/sunspot/dsl/query_facet.rb
kuahyeow-sunspot-0.9.8 lib/sunspot/dsl/query_facet.rb
outoftime-sunspot-0.9.0 lib/sunspot/dsl/query_facet.rb
outoftime-sunspot-0.9.1 lib/sunspot/dsl/query_facet.rb
outoftime-sunspot-0.9.2 lib/sunspot/dsl/query_facet.rb
outoftime-sunspot-0.9.3 lib/sunspot/dsl/query_facet.rb
outoftime-sunspot-0.9.4 lib/sunspot/dsl/query_facet.rb
outoftime-sunspot-0.9.5 lib/sunspot/dsl/query_facet.rb
outoftime-sunspot-0.9.6 lib/sunspot/dsl/query_facet.rb
outoftime-sunspot-0.9.7 lib/sunspot/dsl/query_facet.rb
outoftime-sunspot-0.9.8 lib/sunspot/dsl/query_facet.rb
sunspot-0.9.8 lib/sunspot/dsl/query_facet.rb
sunspot-0.9.7 lib/sunspot/dsl/query_facet.rb