TS doesn't have a count function built-in, so you're going to have to break out 
the SQL:

  has "COUNT(lessons.id)", :as => :num_lessons, :type => :integer

Give that a shot.

Cheers

-- 
Pat

On 03/02/2011, at 2:47 PM, Benjamin Moses Lieb wrote:

> In my site I would like to be able to sort the "lesson packs" by the
> number of lessons they contain.
> 
>  define_index do
>    indexes :name, :sortable => true
>    indexes :description
>    indexes [ lessons.instructors.first_name,
> lessons.instructors.last_name ], :as => "instructor_name", :sortable
> => true
>    has :created_at, :status
>    has lessons.count, :as => :num_lessons
>  end
> 
> 
> The line:
> 
> has lessons.count, :as => :num_lessons
> 
> doesn't work. This seems like a common/simple issue, but I cannot
> figure out how to do it.
> 
> All help appreciated.
> 
> -- 
> 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.

Reply via email to