You'll want to bring the join in using the 'join' method - unless you're 
referring to it normally for other fields/attributes:

  define_index do
    # ...
    
    join B.C # use association names here
    has "C.guid", :as => :c_guid, :type => :integer # make sure you're using 
the table name in the SQL snippet.
  end

Keep in mind that this will only work if A has_one/belongs_to B, and B 
has_one/belongs_to C - otherwise you're going to get multiple C records per A.

Cheers

-- 
Pat

On 24/08/2011, at 6:04 AM, jatugade wrote:

> Hi,
> 
> Say we have three models A, B, C. A is associated with B and B is
> associated with C. I want to index a string column 'guid' in C as an
> attribute of model A. How do I go about doing that?
> 
> I was trying to do it like this:
> class A
>   define_index
>       has "CRC32(B.C.guid)", :as => :c_guid, :type =>integer
>   end
> end
> 
> But I'm getting:    "Unknown column 'B.C.guid' in 'field list'"
> 
> Any ideas? Thank you!!
> 
> -- 
> 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