Hello All,

I am having an issue with AAF and sorting results of a search. Right
now, I have results being split onto pages of 10. The results are being
sorted alphabetically, but not across multiple pages - it's just sorting
the 10 it pulls down on each page. I noticed another post from April
regarding this same issue (http://www.ruby-forum.com/topic/62993#66934)
where the issue was claimed to be resolved - so I figure I'm doing
something wrong - but I just can't figure it out. Any help anyone can
give would be appreciated. Thanks!


Member.rb (model)
def self.full_text_search(q, options = {}, find_options = {})
  return nil if q.nil? or q == ""

  default_options = {:limit => 10, :page => 1}
  options = default_options.merge options
  options[:offset] = options[:limit] * (options.delete(:page).to_i-1)

  results = Member.find_by_contents(q, options, find_options)
  return [results.total_hits, results]
end


(controller)
sortable_fields = []
sortable_fields << Ferret::Search::SortField.new('company_name')

@total, @members = Member.full_text_search("Restaurants", {:page =>
(params[:page]||1), :sort => sortable_fields}, {:include =>
[:categories, :discounts], :order => ["members.company_name ASC"]})

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

Reply via email to