pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 468 forks source link

NoMethodError - undefined method `to_sym' for nil:NilClass #292

Closed christianhellsten closed 12 years ago

christianhellsten commented 12 years ago

TS fails with the following error if the primary key index is missing on a table:

NoMethodError - undefined method `to_sym' for nil:NilClass:
..shared/bundle/ruby/1.8/gems/thinking-sphinx-2.0.7/lib/thinking_sphinx/source/internal_properties.rb:6:in `add_internal_attributes_and_facets'
..shared/bundle/ruby/1.8/gems/thinking-sphinx-2.0.7/lib/thinking_sphinx/source.rb:35:in `initialize'
..shared/bundle/ruby/1.8/gems/thinking-sphinx-2.0.7/lib/thinking_sphinx/index/builder.rb:268:in `new'

Looks like an old issue: http://groups.google.com/group/thinking-sphinx/browse_thread/thread/2431d6ca8788f478/bc67f969f344a1d7

pat commented 12 years ago

Hi Christian

Can you clarify what you mean by the primary key index being missing?

christianhellsten commented 12 years ago

Hi Pat

I meant the index on the id column. Adding the index fixes the issue, e.g.:

create unique index index_products_on_index on products(id);

The index should be there, but it can be deleted by mistake.

pat commented 12 years ago

Huh, that's an odd one. I wouldn't expect Rails to use that to determine the primary key. If I find some time, I'll set up a test app and try to reproduce the issue. With that in mind, are you using MySQL, or PostgreSQL?

On 01/10/2011, at 5:08 PM, Christian Hellsten wrote:

Hi Pat

I meant the index on the id column. Adding the index fixes the issue, e.g.:

create unique index index_products_on_index on products(id);

The index should be there, but it can be deleted by mistake.

Reply to this email directly or view it on GitHub: https://github.com/freelancing-god/thinking-sphinx/issues/292#issuecomment-2256069

christianhellsten commented 12 years ago

Thanks. I'm using MySQL.

christianhellsten commented 12 years ago

Forgot to say that it fails when running ts:in or ts:conf, not when performing searches, so hopefully it should be easy to reproduce...

pat commented 12 years ago

Patched - just defaulting to a primary key of id. Will try to get a new release out in the next 24 hours. Thanks for the debugging help :)