Issues while re-indexing #216

Ratzzak opened this Issue Apr 20, 2012 · 12 comments


None yet

6 participants

Ratzzak commented Apr 20, 2012

I have configured solr using sunspot on my rails application which uses mongodb and when I run the reindex command rake sunspot:reindex it gives me this error:

rake aborted!
undefined method `indexing' for #<LightConfig::Configuration:0xb5472ec>

This is my model

class Article
  include Mongoid::Document
  field :name
  field :content

  include Sunspot::Mongoid
  searchable do
    text :name, :content

Can you post the output when you run rake with --trace?

Ratzzak commented Apr 20, 2012


Thanx for quick reply. Here is the trace file

** Invoke sunspot:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:reindex
Re-indexing Article
rake aborted!
undefined method indexing' for #<LightConfig::Configuration:0xb040c44> /home/rahul/.rvm/gems/ruby-1.9.2-p290/bundler/gems/sunspot_mongoid-d269b497de00/lib/sunspot/mongoid.rb:43:insolr_index'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/sunspot_rails-1.3.1/lib/sunspot/rails/searchable.rb:198:in solr_reindex' /home/rahul/.rvm/gems/ruby-1.9.2-p290/bundler/gems/sunspot_mongoid-d269b497de00/tasks/sunspot_mongoid.rake:44:inblock (3 levels) in <top (required)>'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/bundler/gems/sunspot_mongoid-d269b497de00/tasks/sunspot_mongoid.rake:42:in each' /home/rahul/.rvm/gems/ruby-1.9.2-p290/bundler/gems/sunspot_mongoid-d269b497de00/tasks/sunspot_mongoid.rake:42:inblock (2 levels) in <top (required)>'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- call' /home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- in execute'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- each' /home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake-'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- block in invoke_with_call_chain' /home/rahul/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:inmon_synchronize'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- invoke_with_call_chain' /home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake-'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- invoke_task' /home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- (2 levels) in top_level'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- each' /home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- in top_level'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- standard_exception_handling' /home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake-'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- block in run' /home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake-'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake- run' /home/rahul/.rvm/gems/ruby-1.9.2-p290/gems/rake-<top (required)>'
/home/rahul/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in load' /home/rahul/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in

Tasks: TOP => sunspot:reindex


It looks like you're using a git version of sunspot_mongoid .. maybe a custom version? Can you post the line from your Gemfile that brings it in?

Ratzzak commented Apr 20, 2012


This is the sunspot_mongoid gem I am using
gem 'sunspot_mongoid', :git => ''

When I normally use gem 'sunspot_mongoid', I get the following error while reindexing
undefined method 'find_in_batches' for Article:Class
I was suggested to use that gem to solve this issue.


Ah, default_batch_size was introduced in the master branch of Sunspot. It's not available in 1.3.x.

You might try upgrading sunspot (or sunspot_rails) to ~>2.0.0.pre.


That worked for me, thanks!

@alindeman alindeman closed this Apr 25, 2012
Ratzzak commented Apr 26, 2012

@alindeman Still didnt work for me
@marbemac Could you please let me know what are the exact gems u were using?

AaronH commented Apr 27, 2012

Yeah, I'm still having this issue using a forked version of sunspot_mongoid as well. I'm looking to track down a solution, bout wanted to make sure @Ratzzak knew he wasn't alone.

AaronH commented Apr 27, 2012

@Ratzzak It looks like the problem was introduced in these 3 commits from March 26/27. I tried simply replacing the references to Sunspot.config.indexing.default_batch_size with a number, but there are other problems introduced with version skew, etc. since then. I don't have time to sort it out in my own fork at this time, but if you change your gem file as follows it should work.

gem 'sunspot_mongoid', git: 'git://', ref: '5d379c6cdde37851beac5547742fc61b1653a6ae'
AaronH commented Apr 27, 2012

Actually, I was able to find the problem (a simple typo) in My fork at has those problems fixed and now works as expected. I'll be submitting my pull request.


thanks ,this solved my problems

nengine commented Sep 22, 2012

Hi, I was able to reindex, however getting "NameError: uninitialized constant Sunspot::Mongoid::DataAccessor::BSON"

search = do
      fulltext 'apple'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment