Hi,

I've resolved this in the end, I've not got a stack trace anymore but I tracked 
the error back to the translate method in Thinking Sphinx. That was causing 
ThinkingSphinx to look for a method on the AR model matching the SQL. I should 
mention this was with 1.4.11 not 2, since this is a rails 2.3 app.

In the end I solved it using the following

has search_tags(:id), :as => :search_tag_ids, :facet => true
has "GROUP_CONCAT(DISTINCT (CASE `search_tags`.`tag_type` WHEN 'Topic' THEN 
`search_tags`.`id` ELSE NULL END) SEPARATOR ',')", :type => :multi, :as => 
:topic_tag_ids, :facet => true, :all_ints => true

I needed both the :type => :multi and :all_ints => true to prevent Thinking 
Sphinx from trying to translate the results.

Thanks

jebw

On 8 Feb 2012, at 00:55, Pat Allan wrote:

> 
> Hi Jeb
> 
> Can you share the search query that's causing the problem? And perhaps the 
> stack trace as well?
> 
> Thanks
> 
> -- 
> Pat
> 
> On 08/02/2012, at 2:40 AM, jebw wrote:
> 
>> Hi,
>> 
>> I've got posts with a bunch of tags joined against them, only certain
>> tag types should be used for the attribute. The whole dataset gets
>> grouped by the Post's id.
>> 
>> I'm defining a custom attribute for my Sphinx index using something
>> like the following
>> 
>> has "GROUP_CONCAT(CASE tag.tag_type WHEN 'Normal' THEN tag.tag ELSE
>> NULL END)', :type => :string, :as => :normal_tag
>> 
>> but this is triggering an active record NoMethodError: . It is trying
>> to find a method on the model matching that piece of SQL? This is only
>> causing a problem during search, index seems to be happy with it, and
>> I've looked at the generated SQL and that appears to be fine?
>> 
>> Is custom SQL supported for the attributes?
>> 
>> Thanks
>> 
>> jebw
>> 
>> -- 
>> 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.

Reply via email to