Method: Sunspot::Query::Sort.special

Defined in:
lib/sunspot/query/sort.rb

.special(name) ⇒ Object

Certain field names are “special”, referring to specific non-field sorts, which are generally by other metrics associated with hits.

XXX I’m not entirely convinced it’s a good idea to prevent anyone from ever sorting by a field named ‘score’, etc.



25
26
27
28
29
30
# File 'lib/sunspot/query/sort.rb', line 25

def special(name)
  special_class_name = "#{Util.camel_case(name.to_s)}Sort"
  if const_defined?(special_class_name) && special_class_name != 'FieldSort'
    const_get(special_class_name)
  end
end