Class: Ferret::Search::Sort

Inherits:
Object
  • Object
show all
Defined in:
ext/r_search.c

Overview

Summary

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.

Example

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.