Hi,

I have a user model connected to post (has_many :posts).

This is my index:

  define_index do
    indexes first_name, :sortable => true
    indexes last_name, :sortable => true
    indexes city
    indexes state
    indexes country
    indexes home_climate_zones
    indexes posts.created_at, :as => :posts, :sortable => true

    has created_at, updated_at
    has show, :type => :boolean
    has aid_work, :type => :boolean
    has consultant, :type => :boolean
    has pdc_teacher, :type => :boolean
    has "lat",  :as => :lat,  :type => :float
    has "lng", :as => :lng, :type => :float

    set_property :delta => true
  end

I want to get the users, ordered by the last post they have maid, then
by when the user has been created:

      self.search(search,
                  :conditions => conditions,
                  :with => with,
                  :sort_mode => :extended,
                  :order => "posts DESC, created_at DESC",
                  :per_page => 9, :page => page)

But they are not ordered by post.created_at. The following SQL query
works as espected:

        self.paginate_by_sql("SELECT users.* FROM users, posts
                              WHERE users.id = posts.user_id
                              GROUP BY first_name, last_name
                              ORDER BY posts.created_at DESC",
                              :per_page => 9, :page => page)

Do you have an idea why it is not ordering?

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