Skip to content

Commit

Permalink
Merge branch 'master' of github.com:outoftime/sunspot
Browse files Browse the repository at this point in the history
* 'master' of github.com:outoftime/sunspot:
  We require nokogiri the first time the sunspot:solr:start task is run, to update the local Solr config files.
  Turn reindexing batches down to 50, in hopes of not hitting Heroku's memory limits for Rake tasks. Generally the serialization time >> batch commit time.
  removing testing warnings
  • Loading branch information
outoftime committed Dec 29, 2010
2 parents 7047473 + 8a73136 commit ea3472d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions sunspot_rails/lib/sunspot/rails/searchable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def solr_reindex(options = {})
#
# Add/update all existing records in the Solr index. The
# +batch_size+ argument specifies how many records to load out of the
# database at a time. The default batch size is 500; if nil is passed,
# database at a time. The default batch size is 50; if nil is passed,
# records will not be indexed in batches. By default, a commit is issued
# after each batch; passing +false+ for +batch_commit+ will disable
# this, and only issue a commit at the end of the process. If associated
Expand All @@ -197,7 +197,7 @@ def solr_reindex(options = {})
# ==== Options (passed as a hash)
#
# batch_size<Integer>:: Batch size with which to load records. Passing
# 'nil' will skip batches. Default is 500.
# 'nil' will skip batches. Default is 50.
# batch_commit<Boolean>:: Flag signalling if a commit should be done after
# after each batch is indexed, default is 'true'
# include<Mixed>:: include option to be passed to the ActiveRecord find,
Expand All @@ -210,21 +210,21 @@ def solr_reindex(options = {})
#
# ==== Examples
#
# # index in batches of 500, commit after each
# # index in batches of 50, commit after each
# Post.index
#
# # index all rows at once, then commit
# Post.index(:batch_size => nil)
#
# # index in batches of 500, commit when all batches complete
# # index in batches of 50, commit when all batches complete
# Post.index(:batch_commit => false)
#
# # include the associated +author+ object when loading to index
# Post.index(:include => :author)
#
def solr_index(opts={})
options = {
:batch_size => 500,
:batch_size => 50,
:batch_commit => true,
:include => self.sunspot_options[:include],
:first_id => 0
Expand Down
2 changes: 1 addition & 1 deletion sunspot_rails/lib/sunspot/rails/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
desc "Reindex all solr models that are located in your application's models directory."
# This task depends on the standard Rails file naming \
# conventions, in that the file name matches the defined class name. \
# By default the indexing system works in batches of 500 records, you can \
# By default the indexing system works in batches of 50 records, you can \
# set your own value for this by using the batch_size argument. You can \
# also optionally define a list of models to separated by a forward slash '/'
#
Expand Down
2 changes: 1 addition & 1 deletion sunspot_rails/spec/rails3/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false

config.active_support.deprecation = :stderr
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
end
4 changes: 2 additions & 2 deletions sunspot_rails/spec/rails3/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MockApp::Application.routes.draw do |map|
MockApp::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down Expand Up @@ -55,5 +55,5 @@
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
map.resources :posts, :only => :create
resources :posts, :only => :create
end
1 change: 1 addition & 0 deletions sunspot_rails/sunspot_rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ TEXT
Dir.glob('spec/mock_app/{app,lib,db,vendor,config}/**/*') +
Dir.glob('spec/mock_app/{tmp,log,solr}')
s.add_dependency 'sunspot', Sunspot::Rails::VERSION
s.add_dependency 'nokogiri'
s.add_development_dependency 'rspec', '~> 1.2'
s.add_development_dependency 'rspec-rails', '~> 1.2'
end

0 comments on commit ea3472d

Please sign in to comment.