【发布时间】:2015-12-09 18:39:20
【问题描述】:
我有以下环境:
Solr 5.3.1 Ubuntu 15.04 导轨 4.4.2 太阳黑子轨道
我的 solr 实例已启动并正在运行,我的生产集合是通过运行创建的
/opt/solr/bin/solr create -c production
从我的生产环境中,我进入 rake 以重新索引并运行如下:rake sunspot:solr:reindex。其结果是以下 http 400 错误:
deploy@vps194508:/opt/www/app1/current/bin$ bundle exec rake sunspot:solr:reindex
(in /opt/www/app1/releases/20151209181633)
Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile
rake aborted!
RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request
Error: {'responseHeader'=>{'status'=>400,'QTime'=>4},'error'=>{'msg'=>'undefined field type','code'=>400}}
URI: http://app1.com:8983/solr/production/update?wt=ruby
Request Headers: {"Content-Type"=>"text/xml"}
Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Event</query></delete>"
Backtrace: /opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:284:in `adapt_response'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:190:in `execute'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:176:in `send_and_receive'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications.rb:164:in `block in instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications.rb:164:in `instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:82:in `update'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:146:in `delete_by_query'/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:284:in `adapt_response'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:190:in `execute'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:176:in `send_and_receive'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications.rb:164:in `block in instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications.rb:164:in `instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:82:in `update'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:146:in `delete_by_query'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/indexer.rb:68:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session.rb:197:in `block in remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session.rb:197:in `each'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session.rb:197:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot.rb:502:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/searchable.rb:190:in `solr_remove_all_from_index'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/searchable.rb:209:in `solr_reindex'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/tasks.rb:60:in `block (4 levels) in <top (required)>'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/class_set.rb:16:in `each'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/class_set.rb:16:in `each'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/tasks.rb:59:in `block (3 levels) in <top (required)>'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/tasks.rb:71:in `with_session'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/tasks.rb:19:in `block (2 levels) in <top (required)>'
Tasks: TOP => sunspot:solr:reindex => sunspot:reindex
(See full trace by running task with --trace)
有人可以解释为什么会发生这种情况以及我该如何解决它。在开发中一切正常。在生产中,我的生产集合是空的,因此尝试重新索引,但它失败并出现这个错误的请求 400 错误。
【问题讨论】:
标签: ruby-on-rails solr lucene sunspot-rails sunspot-solr