title: Sunspot error 400 Bad Request when reindex
body: <p>I'm using sunspot/solr to build a full text search for my rails app. 
  I was able to run bundle exec rake sunspot:reindex for the first couple times but then I received this error:</p>
  
  <pre><code>RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request
  Error: {'responseHeader'=&gt;{'status'=&gt;400,'QTime'=&gt;1},'error'=&gt;{'msg'=&gt;'Exception writing document id Product 1 to the index; possible analysis error.','code'=&gt;400}}
  
  URI: http://localhost:8982/solr/development/update?wt=ruby
  Request Headers: {"Content-Type"=&gt;"text/xml"}
  Request Data: "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;&lt;add&gt;&lt;doc&gt;&lt;field name=\"id\"&gt;Product 1&lt;/field&gt;&lt;field name=\"type\"&gt;Product&lt;/field&gt;&lt;field name=\"type\"&gt;ActiveRecord::Base&lt;/field&gt;&lt;field name=\"class_name\"&gt;Product&lt;/field&gt;&lt;field boost=\"5\" name=\"code_textp\"&gt;Macbook pro 123&lt;/field&gt;&lt;field name=\"code_textp\"&gt;&amp;lt;p&amp;gt;hahahahahhhahahahahhhahahahahhhahahahahhhahahahahhhahahahahhhahahahahhhahahahahh&amp;lt;/p&amp;gt;&lt;/field&gt;&lt;/doc&gt;&lt;doc&gt;&lt;field name=\"id\"&gt;Product 2&lt;/field&gt;&lt;field name=\"type\"&gt;Product&lt;/field&gt;&lt;field name=\"type\"&gt;ActiveRecord::Base&lt;/field&gt;&lt;field name=\"class_name\"&gt;Product&lt;/field&gt;&lt;field boost=\"5\" name=\"code_textp\"&gt;test product&lt;/field&gt;&lt;field name=\"code_textp\"&gt;&amp;lt;p&amp;gt;dfdsfsdfdsfsfsdfsdfdsf&amp;lt;/p&amp;gt;&lt;/field&gt;&lt;/doc&gt;&lt;doc&gt;&lt;field name=\"id\"&gt;Product 3&lt;/field&gt;&lt;field name=\"type\"&gt;Product&lt;/field&gt;&lt;field name=\"type\"&gt;ActiveRecord::Base&lt;/field&gt;&lt;field name=\"class_name\"&gt;Product&lt;/field&gt;&lt;field boost=\"5\" name=\"code_textp\"&gt;Macbook used&lt;/field&gt;&lt;field name=\"code_textp\"&gt;&amp;lt;p&amp;gt;it is refurebishedit is refurebishedit is refurebishedit is refurebishedit is refurebishedit is refurebishedit is refurebished&amp;lt;/p&amp;gt;&lt;/field&gt;&lt;/doc&gt;&lt;/add&gt;"
  
  Backtrace: /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:284:in `adapt_response'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:190:in `execute'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:176:in `send_and_receive'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `block in instrument'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `instrument'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
  (eval):2:in `post'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:82:in `update'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:102:in `add'/Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:284:in `adapt_response'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:190:in `execute'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:176:in `send_and_receive'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `block in instrument'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `instrument'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
  (eval):2:in `post'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:82:in `update'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/rsolr-1.0.13/lib/rsolr/client.rb:102:in `add'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot/indexer.rb:127:in `add_documents'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot/indexer.rb:134:in `add_batch_documents'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot/indexer.rb:26:in `add'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot/session.rb:91:in `index'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `index'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `index'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot.rb:184:in `index'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/searchable.rb:264:in `block (2 levels) in solr_index'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/searchable.rb:405:in `solr_benchmark'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/searchable.rb:263:in `block in solr_index'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/relation/batches.rb:124:in `find_in_batches'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/searchable.rb:261:in `solr_index'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/searchable.rb:210:in `solr_reindex'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/tasks.rb:60:in `block (4 levels) in &lt;top (required)&gt;'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot/class_set.rb:16:in `each'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot-2.2.4/lib/sunspot/class_set.rb:16:in `each'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/tasks.rb:59:in `block (3 levels) in &lt;top (required)&gt;'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/tasks.rb:71:in `with_session'
  /Users/LouisHoang/.rvm/gems/ruby-2.2.3/gems/sunspot_rails-2.2.4/lib/sunspot/rails/tasks.rb:19:in `block (2 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>The only way that I can fix this error is to reinstall the gem. I wonder if someone met the same problem?</p>
  
  <p>Here is my model:</p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
  searchable do
      text :name, :as =&gt; :code_textp, :boost =&gt; 5
      text :description, :as =&gt; :code_textp
      integer :id, :seller_id, :stock_quantity
      string :shipping_method
      string :condition, :location, :slug, :status, :city, :state, :product_image
      double :price 
      integer :category_ids, :multiple =&gt; true
      time :created_at, :updated_at
      latlon(:location) { Sunspot::Util::Coordinates.new(latitude, longitude) }
    end
  ...
  </code></pre>
  
  <p>I use default setting for schema.xml and solr is running when visiting <a href="http://localhost:8982/" rel="nofollow">http://localhost:8982/</a></p>
  
  <p>Thanks for helping.</p>