Sorry, delayed response... trying to catch up haphazardly on some older emails.

I think the issue here could be that location is not an attribute - and you can 
only sort by attributes. Because you're using :sortable => true, then an 
attribute is created for location, called location_sort. Normally TS translates 
this for :order options - but it doesn't for :group_function, so you'll need to 
cover that limitation.

Essentially, try the following:
  Performance.search(
    :group_by       => 'group_production',
    :group_function => :attr,
    :group_clause   => 'location_sort ASC'
  )

Hopefully this is useful.

-- 
Pat

On 25/08/2010, at 3:25 PM, robdoan wrote:

> I defined index like this :
> 
> define_index do
> indexes "LOWER(IF(`performances`.`title` IS NOT NULL AND
> `performances`.`title` != '', \
>                   `performances`.`title`,
> `productions`.`title`))",  :as => :title,    :sortable => true
> indexes "IF(`performances`.`location_id` IS NOT NULL, \
>                `locations`.`name`,
> `performances`.`location_name`)", :as => :location, :sortable => true
> has "CRC32(CONCAT(LOWER(IF(`performances`.`title` IS NOT NULL AND
> `performances`.`title` != '', \
>                   `performances`.`title`, `productions`.`title`)),
> `performances`.`production_id`))",
>                    :as => :group_production, :type => :integer
> end
> And when I search with condition
> 
> Performace.search(:group_by=>'group_production', :group_function=>:attr, 
> :group_clause=>'location
> ASC')
> 
> It return no result.
> 
> When i remove group clause option , It returns values.
> 
> Can you help me this issue ?
> 
> I am sorry for my English.
> 
> -- 
> 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