OK. I'm trying to start this fresh, but I guess I was never sorting the
results via AAF to begin with. Does anyone know how to sort the ferret
results? Here are some things I have tried (console output)

>> members = Member.find_by_contents("bank", {:sort => "company_name", :limit 
>> => 50}, {})
... [members array displayed]...
>> members.each {|member| puts member.company_name}
SouthTrust Bank
Colonial Bank
SunTrust Bank
Citrus & Chemical Bank
Bank of America
Citizens Bank & Trust
Platinum Bank
CenterState Bank of Florida
Riverside National Bank
AmSouth Bank
Community National Bank
Washington Mutual Bank
Providence Bank
Olde Cypress Community Bank

>> sort_fields = []
=> []
>> sort_fields = Ferret::Search::SortField.new('company_name')
=> company_name:<auto>
>> members = Member.find_by_contents("bank", {:sort => sort_fields, :limit => 
>> 50}, {})

>> members.each {|member| puts member.company_name}
SouthTrust Bank
Colonial Bank
SunTrust Bank
Citrus & Chemical Bank
Bank of America
Citizens Bank & Trust
Platinum Bank
CenterState Bank of Florida
Riverside National Bank
AmSouth Bank
Community National Bank
Washington Mutual Bank
Providence Bank
Olde Cypress Community Bank

>> members = Member.find_by_contents("bank", {:limit => 50}, {:order => 
>> "company_name"})

>> members.each {|member| puts member.company_name}
AmSouth Bank
Bank of America
CenterState Bank of Florida
Citizens Bank & Trust
Citrus & Chemical Bank
Colonial Bank
Community National Bank
Olde Cypress Community Bank
Platinum Bank
Providence Bank
Riverside National Bank
SouthTrust Bank
SunTrust Bank
Washington Mutual Bank

(Good, except for the fact that I only want 10 at a time)...

>> members = Member.find_by_contents("bank", {:limit => 10}, {:order => 
>> "company_name"})
>> members.each {|member| puts member.company_name}
AmSouth Bank
Bank of America
CenterState Bank of Florida
Citizens Bank & Trust
Citrus & Chemical Bank
Colonial Bank
Platinum Bank
Riverside National Bank
SouthTrust Bank
SunTrust Bank

(I have also tried the line below this with :sort => sort_fields AND
:sort => "company_name" with no luck!)
>> members = Member.find_by_contents("bank", {:limit => 10, :offset => 10}, 
>> {:order => "company_name"})
>> members.each {|member| puts member.company_name}
Community National Bank
Olde Cypress Community Bank
Providence Bank
Washington Mutual Bank

Now I know thats the same problem I described above, but I will settle
for any help I can get !!! I've tried Member.ferret_index.search("bank",
:sort => .... also tried Member.ferret_index.search_each("bank", :sort
=> ... Is this even possible to do what I need?

I cant pass the :order => "company_name ASC" as a find_option because by
the time it goes to AR to get the records, it has already returned the
IDs for the 10 records so I'm only ordering those 10 records and not the
entire set of 14. PLEASE HELP!!! Thanks!

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

Reply via email to