在rails 4.0.2中,我使用spo黑子solr作为搜索引擎。这里有一个文本字段,它包含带有特殊字符的大文本(数据)。
在运行重新索引命令时,我收到一个类似Backtrace: /home/shruthi/.rvm/gems/ruby-2.1.2/gems/rsolr-1.0.10/lib/rsolr/client.rb:283:in 'adapt_response'...
的错误
在模型中,
searchable do
string :cv_content
end
使用宝石是,
sunspot (2.1.1)
sunspot_rails (2.1.1)
sunspot_solr (2.1.1)
如何解决重新索引问题?
完全错误:
Backtrace: /home/shruthi/.rvm/gems/ruby-2.1.2/gems/rsolr-1.0.10/lib/rsolr/client.rb:283:in
自适应响应'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rsolr--1.0.10/lib/rsolr/client.rb:190:在execute'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rsolr-1.0.10/lib/rsolr/client.rb:176:in
send_and_receive'中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob_rails-2.1.1.lib/soprob/rails/solr_instrumentation.rb:16:在instrument'中的block in send_and_receive_with_as_instrumentation'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.2/lib/active_support/notifications.rb:159:in
块中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.2/lib/active_support/nootifications/instrumenter.rb:20:in instrument'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.2/lib/active_support/notifications.rb:159:in
instrument'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob_rails-2.1.1.lib/soprob/rails/solr_instrumentation.rb:15:in send_and_receive_with_as_instrumentation'
(eval):2:in
post'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rsolr--1.010/lib/rsolr/client.rb:82:在update'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rsolr-1.0.10/lib/rsolr/client.rb:102:in
中添加'/home/shurthi/_rvm/ruby-2.1.2/gems/rslr--1.010/lib/rsolr/client.rb:283:在adapt_response'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rsolr-1.0.10/lib/rsolr/client.rb:190:in
中执行'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rsolr--1.0.10/lib/rsolr/client.rb:176:在send_and_receive_with_as_instrumentation'中的send_and_receive'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot_rails-2.1.1/lib/sunspot/rails/solr_instrumentation.rb:16:in
块中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.2/lib/active_support/nootifications.rb:159:在block in instrument'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:in
仪器中'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/activesupport-4.0.2/lib/active_support/nootifications.rb:159:在instrument'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot_rails-2.1.1/lib/sunspot/rails/solr_instrumentation.rb:15:in
send_and_rereceive_with_as_instrumentation'中(eval):2:在post'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rsolr-1.0.10/lib/rsolr/client.rb:82:in
更新中'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rsolr--1.010/lib/rsolr/client.rb:102:in add'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot-2.1.1/lib/sunspot/indexer.rb:107:in
add_documents'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob-2.1.1/lib/sporob/indexer.rb:30:在add'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot-2.1.1/lib/sunspot/session.rb:91:in
索引中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob-2.1.1/lib/sporob/session_proxy.rb:11:in index'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot-2.1.1/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in
method_missing'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob-2.1.1/lib/sporob/session_proxy.rb:11:in index'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot-2.1.1/lib/sunspot.rb:184:in
index'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob_rails-2.1.1.lib/soprob/rails/searcher.rb:257:在block (2 levels) in solr_index'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot_rails-2.1.1/lib/sunspot/rails/searchable.rb:360:in
solr_benchmark'中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob_rails-2.1.1.lib/soprob/rails/searched.rb:256:在block in solr_index'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/activerecord-4.0.2/lib/active_record/relation/batches.rb:75:in
find_in_batches中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/activerecord-deprested_finders-1.0.3/lib/active_record/depleted_finders/rerelations.rb:70:在find_in_batches'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot_rails-2.1.1/lib/sunspot/rails/searchable.rb:254:in
solr_index'中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob_rails-2.1.1.lib/soprob/rails/searched.rb:203:在'中的solr_reindex'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot_rails-2.1.1/lib/sunspot/rails/tasks.rb:57:in
块(4级)中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob-2.1.1/lib/sporob/class_set.rb:16:in each'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot-2.1.1/lib/sunspot/class_set.rb:16:in
each'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob_rails-2.1.1.lib/soprob/rails/tasks.rb:56:in block (3 levels) in <top (required)>'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/sunspot_rails-2.1.1/lib/sunspot/rails/tasks.rb:68:in
with_session'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/soprob_rails-2.1.1.lib/soprob/rails/tasks.rb:19:在block (2 levels) in <top (required)>'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:in
调用中'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:在block in execute'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:in
中,每个'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:在invoke_with_call_chain'中的execute'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:179:in
块中/home/shurthi/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/monitor.rb:211:在mon_synchronize'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:172:in
invoke_with_call_chain'中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:165:在invoke'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:150:in
invoke_task'中/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in block (2 levels) in top_level'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in
each'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in block in top_level'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:115:in
run_with_threads'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:100:运行中的top_level'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:78:in
块/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:176:在standard_exception_handling'
/home/shruthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:75:in
运行中'/home/shurthi/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/bin/rake:33:in <top (required)>'
/home/shruthi/.rvm/gems/ruby-2.1.2/bin/rake:23:in
load'/home/shurthi/.rvm/gems/ruby-2.1.2/bin/rake:23:in <main>'
/home/shruthi/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in
eval'/home/shurthi/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:在<main>'
Tasks: TOP => sunspot:reindex
中
推荐来自ticket solr,spoop,错误请求,非法字符我用建议的代码创建了config/initializers/soprob.rb,它做到了。
这是该票证中提到的问题,也是代码最初提出的地方。https://github.com/sunspot/sunspot/issues/570