On Sat, Mar 31, 2007 at 03:45:40PM +0200, Manoel Lemos wrote:
> I have this model:
> 
> class Post < ActiveRecord::Base
> 
>   acts_as_ferret  :fields => {  :title            => {:boost => 2},
>                                 :description      => {},
>                                 :url              => {},
>                                 :rank_sort        => {:index =>
> :untokenized_omit_norms, :term_vector => :no},
>                                 :posted_at_sort   => {:index =>
> :untokenized_omit_norms, :term_vector => :no}
>                             },  :remote => true
> 
>   belongs_to :blog
> 
[..]
> >> h,r = Post.full_text_search("voltamos", {:sort => 
> >> Ferret::Search::SortField.new("rank_sort", :reverse => :no)} 
> >> )[1].last.posted_at_sort
> => [1085549830]

First of all, use symbols for your field name (don't know if that
solves the problem, but you should use symbols for fieldnames
everywhere).

Then, try to give an array of sort fieldsas value of the :sort
parameter, and specify the correct type for your integer fields. So to
sort by rank_sort, descending, do:

:sort => [ Ferret::Search::SortField.new(:rank_sort, :type => :integer, 
:reverse => true) ]

Jens

-- 
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[EMAIL PROTECTED] | www.webit.de
 
Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to