class SunspotMatchers::OrderByMatcher
Public Instance Methods
args()
click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 252 def args return @args unless direction_wildcard? @args[0...-1] + [:asc] end
build_comparison_search()
click to toggle source
Calls superclass method
SunspotMatchers::BaseMatcher#build_comparison_search
# File lib/sunspot_matchers/matchers.rb, line 257 def build_comparison_search if field_wildcard? @comparison_params = {:sort => any_param} elsif direction_wildcard? super @comparison_params = comparison_params @comparison_params[:sort].gsub!("asc", any_param) else super end end
direction_wildcard?()
click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 248 def direction_wildcard? @args.length == 2 && @args.last == any_param end
field_wildcard?()
click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 244 def field_wildcard? @args.first == any_param end
keys_to_compare()
click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 233 def keys_to_compare [:sort] end
search_method()
click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 229 def search_method :order_by end
wildcard_matcher_for_keys()
click to toggle source
# File lib/sunspot_matchers/matchers.rb, line 237 def wildcard_matcher_for_keys return {:sort => /./} if field_wildcard? param = comparison_params[:sort] regex = Regexp.new(param.gsub(any_param, '.*')) {:sort => regex} end