Hi i have a column in  my ferret model called sponsored. It is a boolean 
and i want to order the results by sponsored and date registered. At the 
moment it is not managing to sort the booleans.
I tried declaring this in my model but it seems to have had no effect.

                def false.<=>(o) o ? -1 : 0 end
                def true.<=>(o)  !o ? 1 : 0 end
I'm using the acts_as_ferret plugin.
below is the relevent code that i'm currently using.


sort_fields = []
sort_fields << Ferret::Search::SortField.new("sponsorerd")
sort_fields << Ferret::Search::SortField.new("ferret_date_registered", 
:reverse => :true)

results = VoObject.find_by_contents(query,:first_doc=>page, :num_docs=> 
20,:sort =>sort_fields)

Thanks in advance for any replies.

regards
c

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to