Hi Pat, TS 1.3.20
There is result, but not sorted. I am suspecting it's not catching any value from "rating_average". What' s the difference between trip(:rating_average) and trip.rating_average? Thank you. Sincerely Yours, Victor Ng *Time Zone*: (UTC+08:00) Kuala Lumpur, Malaysia On Mon, Apr 11, 2011 at 7:22 PM, Pat Allan <[email protected]> wrote: > Hi Victor > > What version of TS are you using? And does an error happen? No results? Or > just not sorted as you'd expect? > > -- > Pat > > On 11/04/2011, at 7:51 PM, Victor wrote: > > > Hi Pat, > > > > This is my TripDay model index: > > > > # ThinkingSphinx Index > > define_index do > > indexes spots.name, :as => :spot_name > > indexes spots.city, :as => :spot_city > > indexes spots.state, :as => :spot_state > > indexes spots.country, :as => :spot_country > > indexes spots.season, :as => :spot_season > > indexes trip.name, :as => :name, :sortable => true > > indexes trip.duration, :as => :duration > > indexes trip.status, :as => :status > > has spots(:id), :as => :spot_id > > #has trip.budget, :as => :budget > > #has trip(:created_at), :as => :created_at > > has trip(:rating_average), :as => :rating_average > > has trip_id > > > > # set_property :delta => true > > end > > > > But it doesn't work. > > > > On Apr 11, 10:28 am, Pat Allan <[email protected]> wrote: > >> Hi Victor > >> > >> You'd need to add that column as an attribute in your TripDay index, via > the trip association. > >> > >> -- > >> Pat > >> > >> On 09/04/2011, at 6:48 PM, Victor wrote: > >> > >> > >> > >> > >> > >> > >> > >>> Hi Pat, using ROR 2.3.8 > >> > >>> I have this in City.rb: > >> > >>> @trip_days = TripDay.published.search params[:keyword], { > >>> :conditions => conditions, > >>> :star => true, > >>> :group_by => 'trip_id', > >>> :group_function => :attr, > >>> :page => params[:page] > >>> }.merge(:order => 'rating_average DESC') > >>> @trips = @trip_days.collect { |trip_day| trip_day.trip } > >> > >>> How can I tell Rails to get the rating_average from Trip model column, > >>> instead of TripDay model? Because the TripDay model does not have > >>> rating_average. It's actually Trip model that gets rated. > >> > >>> Thank you. > >> > >>> -- > >>> You received this message because you are subscribed to the Google > Groups "Thinking Sphinx" group. > >>> To post to this group, send email to [email protected]. > >>> To unsubscribe from this group, send email to > [email protected]. > >>> For more options, visit this group athttp:// > groups.google.com/group/thinking-sphinx?hl=en. > > > > -- > > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > [email protected]. > > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
