Method: Scrivito::ObjSearchEnumerator#order
- Defined in:
- app/cms/scrivito/obj_search_enumerator.rb
#order(field_name) ⇒ Scrivito::ObjSearchEnumerator #order(field_and_direction) ⇒ Scrivito::ObjSearchEnumerator
Orders the results by field_name
.
Applicable to the attribute types string
, enum
, integer
, float
and date
.
There is a precision limit when sorting string values: Only the first 50 characters of a string are guaranteed to be considered when sorting search results.
362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'app/cms/scrivito/obj_search_enumerator.rb', line 362 def order(field_name) field_name, direction = if field_name.is_a?(Hash) field_name.to_a.first else [field_name, :asc] end [:sort_by] = field_name [:sort_order] = direction.to_sym self end |