Hey,

I've read that Sphinx doesn't use MVAs for sorting results. So having
a define_index block like below doesn't work for sorting by
"date_added" where "from" is a datetime type on WeeklyList

class FlightDeal
  define_index do
      has picks.weekly_list.from, :as => :date_added
   end
end

What I really want to use as the value for sorting is the latest date
from the list. I thought of using a SQL fragment like this:

    has "(select wl.from from weekly_lists as wl left outer join picks
as p on (wl.id = p.weekly_list_id) left outer join flight_deals as fd
on (p.deal_type = 'FlightDeal' and p.deal_id = fd.id) order by wl.from
where fd.id = $id limit 1)", :as => :date_added, :type => :datetime

How can I run the query so that its getting the latest date value for
each FlightDeal rather than for the entire flight_deals table?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to