0
votes

I have been trying to get solr 4.9 to reindex our data, from a Ruby-on-Rails application, the way that the old solr 3.4 did.

What I am able to do, is to get the new Tomcat7 and solr 4.9 instance to run. They launch as intended and are accessible through then WebGUI on localhost:8080. But then whenever I attempt to run rake-tasks, reindex for example:

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

Which prompts the following question:

*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)

I answer y and then it malfunctions.

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"

And then the backtrace...

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

--

Now I have looked high and low for this error, but I can't get a consistant answer. It seems that either it is a problem with my schema.xml-file, or it is my solrconfig.xml-file. But I cannot figure out what the problem is.

The old ones, from the solr 3.4 installation, are radically different than the new ones. Plus they seem to have been generated, at least partly, by the Sunspot-gem. In that they have many lines saying:

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

If I try to generate a new one, using:

rails generate sunspot_rails:install

It prompts me to replace sunspot.yml, which contains my setup. And a diff shows that it would replace with jetty-settings. Where I am using Tomcat.

Does anyone have a hint? Anything? Pretty please? :)

1
Your assumption seems correct, the error is caused by a missing type definition that sunspot tries to use in schema.xml. I'm not familar enough with sunspot and it's error messages to say if it's missing a <fieldType> definition or a <field> definition, but schema.xml isn't dependent on the jetty/tomcat difference, so if it generates the schema, diff just that and not the other settings.MatsLindh
It does not generate the schema, it generates the sunspot.yml file. I have no clue as to how a schema is generated. Should I maybe use the sunspot schema.xml from github?lobner

1 Answers

1
votes

Fixed it!

After much boxing around, I was able to fix it by replacing the schema.xml and the solrconfig.xml with the ones from the Sunspot project ¯\(o︹O)/¯