Hey Guys-

I read about tricycledevelopment's custom fork to add custom joins.
I'd ++ adding support for this, I think it's a great feature.

Pat, saw your comment on this commit
http://github.com/tricycle/thinking-sphinx/commit/7d7e6220f366a8b69cc1e02a0d80f7f22a7cb078.
I agree that it's an odd use case but it does happen.

I have an application for which I used to use a separate table for
specific roles for a particular entity, but ended up refactoring to
reduce the unnecessary complexity.  The scenario is a table something
like this:

entities
 - lead_user_id
 - owner_user_id
 - signatory_user_id

I need to have a sphinx attribute that shows relationships to entity
across any of these roles so I can show quickly find related entities
to a specific user.

I can't really create a has_many relationship that encompasses several
relationships.
I suppose I can do a group_concat in a sub-select; but that might lead
to multiple instances of the same attribute ID.

        has "group_concat((select group_concat(distinct(id) SEPARATOR
',') from entities where lead_user_id = users.id OR owner_user_id =
users.id OR signatory_user_id = user.id), 0) SEPARATOR ',')", :type
=> :multi, :as => :entity_ids

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