lib/sunspot/query/field_facet.rb in kuahyeow-sunspot-0.9.8 vs lib/sunspot/query/field_facet.rb in kuahyeow-sunspot-0.10.3

- old
+ new

@@ -26,10 +26,12 @@ ArgumentError, ":time_range key can only be specified for time fields" ) end DateFieldFacet.new(field, options) + elsif options.has_key?(:only) + QueryFieldFacet.new(field, options.delete(:only), options) else FieldFacet.new(field, options) end end end @@ -74,22 +76,19 @@ :"f.#{@field.indexed_name}.facet.#{name}" end end class DateFieldFacet < FieldFacet #:nodoc: - ALLOWED_OTHER = Set.new(%w(before after between none all)) - # # Convert the facet to date params. # def to_params super.merge( :"facet.date" => [@field.indexed_name], param_key('date.start') => start_time.utc.xmlschema, param_key('date.end') => end_time.utc.xmlschema, - param_key('date.gap') => "+#{interval}SECONDS", - param_key('date.other') => others + param_key('date.gap') => "+#{interval}SECONDS" ) end private @@ -122,28 +121,9 @@ # # Integer:: Time interval in seconds # def interval @options[:time_interval] || 86400 - end - - # - # Other time ranges to create facet rows for. Allowed values are defined - # in ALLOWED_OTHER constant. - # - def others - if others = @options[:time_other] - Array(others).map do |other| - other = other.to_s - unless ALLOWED_OTHER.include?(other) - raise( - ArgumentError, - "#{other.inspect} is not a valid argument for :time_other" - ) - end - other - end - end end end end end