ruby on rails - thinking sphinx fails configuring development config -
i have installed thinking sphinx , after running rake ts:index , fails configure development file. file created, empty.
generating configuration /users/lexi87/dating/config/development.sphinx.conf rake aborted! undefined method `type' nil:nilclass /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute/type.rb:64:in `type_from_database' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute/type.rb:17:in `type' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute.rb:4:in `type' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb:30:in `sphinx_type' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb:18:in `collection_type' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/sql_source.rb:107:in `block in prepare_for_render' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/sql_source.rb:104:in `each' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/sql_source.rb:104:in `prepare_for_render' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/active_record/sql_source.rb:61:in `render' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.6/lib/riddle/configuration/index.rb:29:in `block in render' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.6/lib/riddle/configuration/index.rb:29:in `collect' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.6/lib/riddle/configuration/index.rb:29:in `render' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/core/index.rb:48:in `render' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.6/lib/riddle/configuration.rb:39:in `block in render' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.6/lib/riddle/configuration.rb:39:in `collect' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/riddle-1.5.6/lib/riddle/configuration.rb:39:in `render' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/configuration.rb:81:in `render' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/configuration.rb:87:in `block in render_to_file' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/configuration.rb:87:in `render_to_file' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/rake_interface.rb:4:in `configure' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/rake_interface.rb:31:in `index' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/thinking-sphinx-3.0.0/lib/thinking_sphinx/tasks.rb:9:in `block (2 levels) in <top (required)>' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval' /users/lexi87/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>' tasks: top => ts:index
i not sure if related user_index.rb under indices folder.
thinkingsphinx::index.define :user, :with => :active_record # fields indexes content indexes user.name, :as => :user, :sortable => true # attributes has user_id, created_at, updated_at, ethnicity, religion end
here's thinking_sphinx.yml file:
development: mysql41: 9312 test: mysql41: 9313 production: mysql41: 9312
any appreciated.
this error, while not clear, due 1 of attribute references being not quite correct... if you're indexing user model, i'm guessing there isn't association on called user
- so, user_id
should id
, , user.name
should name
:
thinkingsphinx::index.define :user, :with => :active_record # fields indexes content indexes name, :as => :user, :sortable => true # attributes has id, created_at, updated_at, ethnicity, religion end
Comments
Post a Comment