Class: Sunspot::Query::RangeFacet
- Inherits:
-
AbstractFieldFacet
- Object
- AbstractFieldFacet
- Sunspot::Query::RangeFacet
- Defined in:
- lib/sunspot/query/range_facet.rb
Instance Method Summary collapse
-
#initialize(field, options) ⇒ RangeFacet
constructor
A new instance of RangeFacet.
- #to_params ⇒ Object
Constructor Details
#initialize(field, options) ⇒ RangeFacet
Returns a new instance of RangeFacet.
5 6 7 8 9 10 11 12 |
# File 'lib/sunspot/query/range_facet.rb', line 5 def initialize(field, ) if exclude_filters = [:exclude] @exclude_tag = Util.Array(exclude_filters).map do |filter| filter.tag end.join(',') end super end |
Instance Method Details
#to_params ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/sunspot/query/range_facet.rb', line 14 def to_params params = super params[:"facet.range"] = [field_name_with_local_params] params[qualified_param('range.start')] = @field.to_indexed(@options[:range].first) params[qualified_param('range.end')] = @field.to_indexed(@options[:range].last) params[qualified_param('range.gap')] = "#{@options[:range_interval] || 10}" params[qualified_param('range.include')] = @options[:include].to_s if @options[:include] params end |