I'm unable to index my database for searching with sunspot_rails. I get the following error:
Execute sunspot:reindex rake aborted! undefined local variable or method 'counter'
I'm getting the following output after running rake sunspot:reindex. I'm a novice at Rails. I want to add sunspot_rails to my project to add search functionality (with the hope of deploying the project with Heroku).
I'm using Rails 3. I followed the instructions here: https://github.com/outoftime/sunspot/blob/master/sunspot_rails/README.rdoc. My various other attempts to diagnose the problem included:
- installing sunspot in addition to sunspot_rails.
- I ended up with sunspot_rails v. 1.2.0 and 1.2.1 so I uninstalled 1.2.1 because I have sunspot_rails 1.2.0.
- installed the nokogiri gem which I understand is a dependency for sunspot_rails.
installed libxml2 separately following the instructions here to install nokogiri: http://www.engineyard.com/blog/2010/getting-started-with-nokogiri/
** Invoke sunspot:reindex (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute sunspot:reindex rake aborted! undefined local variable or method
counter' for [removed pound]<Class:0x10359aef8> /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:1008:in
method_missing' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/searchable.rb:235:insolr_index' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/relation/batches.rb:71:in
find_in_batches' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:440:in__send__' /Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/base.rb:440:in
find_in_batches' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/searchable.rb:234:insolr_index' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/searchable.rb:184:in
solr_reindex' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/tasks.rb:57 /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/tasks.rb:56:ineach' /Library/Ruby/Gems/1.8/gems/sunspot_rails-1.2.0/lib/sunspot/rails/tasks.rb:56 /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
call' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
each' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:insynchronize' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
invoke_with_call_chain' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
invoke_task' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
each' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in
run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in
run' /Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19
This is what I have in class I'd like to search:
searchable do
text :fname
text :mname
text :lname, :default_boost => 2 end
Any help would be greatly appreciated!