Reference the alias for a join in the index

40 views
Skip to first unread message

Ngan

unread,
Jul 19, 2012, 6:59:10 PM7/19/12
to thinkin...@googlegroups.com
Is there a way to reference the alias name for a joined table during the index declaration?

I have an indexes that joins a table twice.  The second one is aliased, and the first is not.  But then I have a:

has "COUNT(DISTINCT(...))", :as => :foo, :type => :integer

But i'm not sure what to put in place of the "..." so that it references the alias name.  I could hardcode it, but that seems fragile...

Pat Allan

unread,
Jul 20, 2012, 7:40:25 AM7/20/12
to thinkin...@googlegroups.com
I'm afraid there's no easy way to do this - so, hardcoding is probably the way to go. It should be reliable enough, though it does depend on the order of statements within your index definition. If you're not changing that code much/at all, then it's fine.

Of course, make sure you add a test in to ensure it's working as you like :)

--
Pat

> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/To5WRzHte8QJ.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.


Reply all
Reply to author
Forward
0 new messages