|
Sorting/Ordering Search Results: msg#00126lang.ruby.ferret.general
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/. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Search multiple models: 00126, Martin Bernd Schmeil |
|---|---|
| Next by Date: | error of "no such file to load -- ferret_ext": 00126, Daniel Kehoe |
| Previous by Thread: | Error using Ferret - ferret/index.rb:271:in `delete'i: 00126, anil dharni |
| Next by Thread: | error of "no such file to load -- ferret_ext": 00126, Daniel Kehoe |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |