Class | Ferret::Search::Sort |
In: |
ext/r_search.c
|
Parent: | Object |
A Sort object is used to combine and apply a list of SortFields. The SortFields are applied in the order they are added to the SortObject.
Here is how you would create a Sort object that sorts first by rating and then by title;
sf_rating = SortField.new(:rating, :type => :float, :reverse => true) sf_title = SortField.new(:title, :type => :string) sort = Sort.new([sf_rating, sf_title])
Remember that the :type parameter for SortField is set to :auto be default be I strongly recommend you specify a :type value.