Column 'column' in on clause is ambiguous

48 views
Skip to first unread message

Yury

unread,
Nov 17, 2008, 7:15:34 PM11/17/08
to Thinking Sphinx
Hello,

Take a look here http://gist.github.com/25981

I have model Place with multiple acts_as_taggable_on (Place.rb). When
creating index with thinking sphinx (console output from
thinking_sphinx:index) I get error - Column 'context' in on clause is
ambiguous.

It's because generated development.sphinx.conf doesn't specify table
name for context column in things like '(`tags`.`id` =
`taggings`.`tag_id`) AND context = 'place_kind''

If I manualy replace all ' AND context' with ' AND taggings.context'
and create index with indexer - all works fine.

So, does anybody know any workarounds for that? or may be I'm missing
smth? Or point me a place in sources where I could try to fix this.

Pat Allan

unread,
Nov 19, 2008, 3:10:24 AM11/19/08
to thinkin...@googlegroups.com
Hi Yury

I think the problem is that acts_as_taggable doesn't specify the table
name in the joins it generates (it must specify particular conditions,
I guess) - and that's what Thinking Sphinx uses for generated SQL. So,
if there's any way of setting it manually, that'd be the best approach.

Otherwise, you could generate the config using
thinking_sphinx:configure (or ts:conf), make your changes to SQL, and
then run ts:in/thinking_sphinx:index with INDEX_ONLY set to true:
rake thinking_sphinx:index INDEX_ONLY=true

That way the config won't get regenerated automatically.

Hope this helps

Cheers

--
Pat

Yury

unread,
Nov 23, 2008, 8:27:37 AM11/23/08
to Thinking Sphinx
That explains my issue, thanks

On Nov 19, 11:10 am, Pat Allan <p...@freelancing-gods.com> wrote:
> Hi Yury
>
> I think the problem is that acts_as_taggable doesn't specify the table  
> name in the joins it generates (it must specify particular conditions,  
> I guess) - and that's what Thinking Sphinx uses for generated SQL. So,  
> if there's any way of setting it manually, that'd be the best approach.
>
> Otherwise, you could generate the config using  
> thinking_sphinx:configure (or ts:conf), make your changes to SQL, and  
> then run ts:in/thinking_sphinx:index with INDEX_ONLY set to true:
> rake thinking_sphinx:index INDEX_ONLY=true
>
> That way the config won't get regenerated automatically.
>
> Hope this helps
>
> Cheers
>
> --
> Pat
>
> On 18/11/2008, at 10:45 AM, Yury wrote:
>
>
>
> > Hello,
>
> > Take a look herehttp://gist.github.com/25981
Reply all
Reply to author
Forward
0 new messages