使用db:seed的Websolr + Heroku + sunspot_autocomplete

时间:2012-10-19 23:46:43

标签: ruby-on-rails heroku solr websolr

我正在Heroku上设置我的应用程序。已经安装了20美元的websolr插件。迁移已经运行。

运行heroku rake db:seed时出现以下错误。

知道造成这种情况的原因是什么?

$ heroku run rake db:seed
RSolr::Error::Http - 400 Bad Request
Error: <html><head><title>Apache Tomcat/6.0.28 - Error report</title><style><!--H1 {font-    family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status     400 - ERROR: [doc=Dvd 2] unknown field 'dvd_title_as'</h1><HR size="1" noshade="noshade"><p>    <b>type</b> Status report</p><p><b>message</b> <u>ERROR: [doc=Dvd 2] unknown field     'dvd_title_as'</u></p><p><b>description</b> <u>The request sent by the client was     syntactically incorrect (ERROR: [doc=Dvd 2] unknown field 'dvd_title_as').</u></p><HR size="1"     noshade="noshade"><h3>Apache Tomcat/6.0.28</h3></body></html>

Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><add><doc><field name=\"id\">Dvd 2</field><field name=\"type\">Dvd</field><field name=\"type\">ActiveRecord::Base</field><field name=\"class_name\">Dvd</field><field name=\"featured_b\">false</field><field name=\"dvd_title_as\">100% Dirty Slut</field><field name=\"title_text\">100% Dirty Slut</field><field name=\"studio_text\">Cherry Boxxx</field></doc></add>"

Backtrace: /app/vendor/bundle/ruby/1.9.1/gems/rsolr-1.0.8/lib/rsolr/client.rb:230:in `adapt_response'
/app/vendor/bundle/ruby/1.9.1/gems/rsolr-1.0.8/lib/rsolr/client.rb:167:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rsolr-1.0.8/lib/rsolr/client.rb:161:in     `send_and_receive'
(eval):2:in `post'
/app/vendor/bundle/ruby/1.9.1/gems/rsolr-1.0.8/lib/rsolr/client.rb:67:in `update'
/app/vendor/bundle/ruby/1.9.1/gems/rsolr-1.0.8/lib/rsolr/client.rb:87:in `add'
/app/vendor/bundle/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot/indexer.rb:101:in `add_documents'
/app/vendor/bundle/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot/indexer.rb:26:in `add'
/app/vendor/bundle/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot/session.rb:91:in `index'
/app/vendor/bundle/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `index'
/app/vendor/bundle/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot.rb:184:in `index'

Tasks: TOP => db:seed
(See full trace by running task with --trace)

2 个答案:

答案 0 :(得分:2)

该HTML响应中隐藏的错误消息为unknown field 'dvd_title_as'

基本上,您的应用发送给Solr的文档未在schema.xml中定义。您可能需要使用应用的最新架构更新您的websolr索引,您可以通过使用heroku addons:open websolr打开信息中心来执行此操作。

答案 1 :(得分:1)

我建议您访问help.websolr.com并填写支持请求。