Class: Sunspot::Query::AbstractFieldFacet
- Inherits:
-
Object
- Object
- Sunspot::Query::AbstractFieldFacet
- Includes:
- RSolr::Char
- Defined in:
- sunspot/lib/sunspot/query/abstract_field_facet.rb
Direct Known Subclasses
Instance Method Summary (collapse)
-
- (AbstractFieldFacet) initialize(field, options)
constructor
A new instance of AbstractFieldFacet.
- - (Object) to_params
Constructor Details
- (AbstractFieldFacet) initialize(field, options)
A new instance of AbstractFieldFacet
6 7 8 |
# File 'sunspot/lib/sunspot/query/abstract_field_facet.rb', line 6 def initialize(field, ) @field, @options = field, end |
Instance Method Details
- (Object) to_params
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'sunspot/lib/sunspot/query/abstract_field_facet.rb', line 10 def to_params params = { :facet => 'true', } case @options[:sort] when :count params[qualified_param('sort')] = 'true' when :index params[qualified_param('sort')] = 'false' when nil else raise( ArgumentError, "#{@options[:sort].inspect} is not an allowed value for :sort. Allowed options are :count and :index" ) end if @options[:limit] params[qualified_param('limit')] = @options[:limit].to_i end if @options[:prefix] params[qualified_param('prefix')] = escape(@options[:prefix].to_s) end params[qualified_param('mincount')] = case when @options[:minimum_count] then @options[:minimum_count].to_i when @options[:zeros] then 0 else 1 end params end |