Method: Sunspot::DSL::FieldQuery#order_by_function
- Defined in:
- lib/sunspot/dsl/field_query.rb
#order_by_function(*args) ⇒ Object
Specify that results should be ordered based on a FunctionQuery - wiki.apache.org/solr/FunctionQuery Solr 3.1 and up
For example, to order by field1 + (field2*field3):
order_by_function :sum, :field1, [:product, :field2, :field3], :desc
Parameters
- function_name<Symbol>
-
the function to run
- arguments
-
the arguments for this function.
-
Symbol for a field or function name
-
Array for a nested function
-
String for a literal constant
-
- direction<Symbol>
-
:asc or :desc
389 390 391 392 393 |
# File 'lib/sunspot/dsl/field_query.rb', line 389 def order_by_function(*args) @query.add_sort( Sunspot::Query::Sort::FunctionSort.new(@setup,args) ) end |