从solr 3.4迁移到solr 4.9的问题 - RSolr :: Error :: Http - 400 Bad Request

时间:2014-07-10 12:14:39

标签: ruby-on-rails tomcat solr sunspot sunspot-solr

我一直试图让solr 4.9从Ruby-on-Rails应用程序重新索引我们的数据,就像旧的solr 3.4那样。

我能做的是让新的Tomcat7和solr 4.9实例运行。它们按预期启动,可通过localhost:8080上的WebGUI访问。但是每当我尝试运行rake-tasks时,重新索引例如:

$ bundle exec rake sunspot:solr:reindex --trace

提示以下问题:

*Note: the reindex task will remove your current indexes and start from scratch.
If you have a large dataset, reindexing can take a very long time, possibly weeks.
This is not encouraged if you have anywhere near or over 1 million rows.
Are you sure you want to drop your indexes and completely reindex? (y/n)

我回答y然后发生故障。

rake aborted!
RSolr::Error::Http - 400 Bad Request

Error: {'responseHeader'=>{'status'=>400,'QTime'=>39},'error'=>{'msg'=>'undefined field type','code'=>400}}
Request Data: "type:Person"

然后是回溯......

Backtrace: /home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:283:in `adapt_response'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:190:in `execute'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:176:in `send_and_receive'
(eval):2:in `post'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:82:in `update'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:146:in `delete_by_query'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:57:in `remove_all'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session.rb:181:in `block in remove_all'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session.rb:181:in `each'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session.rb:181:in `remove_all'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:283:in `adapt_response'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:190:in `execute'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:176:in `send_and_receive'
(eval):2:in `post'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:82:in `update'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rsolr-1.0.10/lib/rsolr/client.rb:146:in `delete_by_query'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/indexer.rb:57:in `remove_all'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session.rb:181:in `block in remove_all'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session.rb:181:in `each'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session.rb:181:in `remove_all'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot.rb:464:in `remove_all'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot_rails-2.0.0/lib/sunspot/rails/searchable.rb:183:in `solr_remove_all_from_index'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot_rails-2.0.0/lib/sunspot/rails/searchable.rb:202:in `solr_reindex'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot_rails-2.0.0/lib/sunspot/rails/tasks.rb:64:in `block (3 levels) in '
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/class_set.rb:16:in `each'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot-2.0.0/lib/sunspot/class_set.rb:16:in `each'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/sunspot_rails-2.0.0/lib/sunspot/rails/tasks.rb:63:in `block (2 levels) in '
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:195:in `each'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:195:in `invoke_prerequisites'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/home/user/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/gems/rake-10.1.1/bin/rake:33:in `'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/bin/rake:23:in `load'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/bin/rake:23:in `'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/bin/ruby_executable_hooks:15:in `eval'
/home/user/.rvm/gems/ruby-2.1.2@*****.***/bin/ruby_executable_hooks:15:in `'
Tasks: TOP => sunspot:solr:reindex => sunspot:reindex

-

现在我已经看到了这个错误的高低,但我无法得到一致的答案。它似乎是我的schema.xml - 文件的问题,或者它是我的solrconfig.xml - 文件。 但我无法弄清问题是什么。

来自solr 3.4安装的旧版本与新版本完全不同。而且它们似乎至少部分是由太阳黑子宝石产生的。他们有许多说法:

  

<!-- *** This fieldType is used by Sunspot! *** -->

如果我尝试生成新的,请使用:

rails generate sunspot_rails:install

它提示我替换包含我的设置的sunspot.yml。并且差异显示它将替换为码头设置。我在哪里使用Tomcat。

有人有提示吗?什么?好吗? :)

1 个答案:

答案 0 :(得分:1)

修正了它!

经过多次拳击,我能够通过将schema.xmlsolrconfig.xml替换为太阳黑子项目¯\(o︹O)/¯