rake ts:configure rake ts:index thinking-sphinx-3.1.1 ruby-2.0.0 error -


i trying configure rails running application on localhost. have not used sphinx before. have installed sphinx-search on ubuntu machine , service running.

when try execute rake ts:index or rake ts:configure following error:

nomethoderror: undefined method `klass' nil:nilclass 

here full stack trace:

rake ts:configure --trace ** invoke ts:configure (first_time) ** invoke environment (first_time) ** execute environment ** execute ts:configure generating configuration /home/baran/code/atdhe/config/development.sphinx.conf rake aborted! nomethoderror: undefined method `klass' nil:nilclass /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib          /thinking_sphinx/active_record/attribute/type.rb:37:in `block in associations' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib     /thinking_sphinx/active_record/attribute/type.rb:35:in `collect' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib                    /thinking_sphinx/active_record/attribute/type.rb:35:in `associations' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/attribute/type.rb:62:in `multi_from_associations' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib    /thinking_sphinx/active_record/attribute/type.rb:9:in `multi?' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/attribute.rb:4:in `multi?' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb:18:in `collection_type' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:96:in `block in append_presenter_to_attribute_array' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:93:in `each' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:93:in `append_presenter_to_attribute_array' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:132:in `prepare_for_render' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/active_record/sql_source.rb:65:in `render' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration/index.rb:29:in `block in render' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration/index.rb:29:in `collect' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration/index.rb:29:in `render' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/core/index.rb:53:in `render' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration.rb:43:in `block in render' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration.rb:43:in `collect' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/riddle-1.5.11/lib/riddle/configuration.rb:43:in `render' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/configuration.rb:90:in `render' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/configuration.rb:96:in `block in render_to_file' /home/baran/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/open-uri.rb:36:in `open' /home/baran/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/open-uri.rb:36:in `open' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/configuration.rb:96:in `render_to_file' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/rake_interface.rb:13:in `configure' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/thinking-sphinx-3.1.1/lib/thinking_sphinx/tasks.rb:4:in `block (2 levels) in <top (required)>' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:240:in `call' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:240:in `block in execute' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:235:in `each' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:235:in `execute' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain' /home/baran/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:172:in `invoke_with_call_chain' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/task.rb:165:in `invoke' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:150:in `invoke_task' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:106:in `each' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/lib/rake/application.rb:75:in `run' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/gems/rake-10.3.2/bin/rake:33:in `<top (required)>' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/bin/rake:23:in `load' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/bin/rake:23:in `<main>' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/bin/ruby_executable_hooks:15:in `eval' /home/baran/.rvm/gems/ruby-2.0.0-p481@athde/bin/ruby_executable_hooks:15:in `<main>' tasks: top => ts:configure 

here indices files:

thinkingsphinx::index.define :restaurant, :with => :active_record, :delta =>    thinkingsphinx::deltas::delayeddelta    indexes school(:school_name), :sortable => true, :as => :school_name   indexes school(:branch_name), :sortable => true, :as => :branch_name   indexes school(:delta) => thinkingsphinx::deltas::delayeddelta   has restaurant_info(:is_pick_up), :as => :pick_up, :facet => true   has delivery_info(:is_delivery),  :as => :delivery, :facet => true    indexes contact_info(:restaurant_name), :sortable => true    indexes delivery_info(:delivery_charges), :as => :delivery_charges    has school(:id), :as => :school_id, :facet => true    has restaurant_categories(:id), :as => :restaurant_category_ids, :facet => true    has restaurant_info(:min_order), :as => :min_order, :type => :float, :sortable => true    has avg_rating, :as => :rating, :type => :integer, :sortable => true   has ranking, :as => :ranking, :type => :integer, :sortable => true    has delivery_info(:delivery_estimated_time), :as => :delivery_eta, :type => :integer, :sortable => true        set_property :min_infix_len => 1   set_property :delta => thinkingsphinx::deltas::delayeddelta end   thinkingsphinx::index.define :school, :with => :active_record, :delta =>         thinkingsphinx::deltas::delayeddelta   indexes :school_name, :sortable => true, :as => :school_name   indexes buildings(:building_name), :sortable => true   set_property :min_infix_len => 1   set_property :delta => thinkingsphinx::deltas::delayeddelta end 

here's indexes cleaned up:

thinkingsphinx::index.define :restaurant, :with => :active_record, :delta => thinkingsphinx::deltas::delayeddelta    indexes school.school_name, :sortable => true, :as => :school_name   indexes school.branch_name, :sortable => true, :as => :branch_name   indexes contact_info.restaurant_name, :sortable => true, :as => :restaurant_name   indexes delivery_info.delivery_charges, :as => :delivery_charges    has restaurant_info.is_pick_up, :as => :pick_up, :facet => true   has delivery_info.is_delivery,  :as => :delivery, :facet => true   has school.id, :as => :school_id, :facet => true    has restaurant_categories.id, :as => :restaurant_category_ids, :facet => true   has restaurant_info.min_order, :as => :min_order, :type => :float    has avg_rating, :as => :rating, :type => :integer   has ranking, :as => :ranking, :type => :integer    has delivery_info.delivery_estimated_time, :as => :delivery_eta, :type => :integer    set_property :min_infix_len => 1 end  thinkingsphinx::index.define :school, :with => :active_record, :delta => thinkingsphinx::deltas::delayeddelta   indexes school_name, :sortable => true, :as => :school_name   indexes buildings.building_name, :as => :building_name, :sortable => true    set_property :min_infix_len => 1 end 

changes made:

  • :sortable => true removed attributes (the has calls). attributes sortable nature, option changes nothing.
  • removed set_property call deltas - done @ top of index since ts v3 (as you're doing already).
  • removed field referencing delta column, looked kind of delta setting.
  • changed column calls symbols/method arguments method names - using required ruby 1.8, not needed (and may buggy) ts v3 , ruby 1.9 or newer.
  • made sure fields , attributes referring columns via associations had custom names (the :as option).

it's worth noting shouldn't need specify types attributes if columns being used types. so, if avg_rating is integer, don't need :type => :integer option attribute.

my guess combination of field/delta setting main cause of problem, give spin, see if helps things.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -