Permalink
Browse 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.
  • Loading branch information...
1 parent d11e863 commit 3e3bfadf6718c6fd2049795d1afbfa859424e7bf @nz nz committed Dec 29, 2010
Showing with 6 additions and 6 deletions.
  1. +5 −5 sunspot_rails/lib/sunspot/rails/searchable.rb
  2. +1 −1 sunspot_rails/lib/sunspot/rails/tasks.rb
View
10 sunspot_rails/lib/sunspot/rails/searchable.rb
@@ -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
@@ -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,
@@ -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
View
2 sunspot_rails/lib/sunspot/rails/tasks.rb
@@ -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 '/'
#

0 comments on commit 3e3bfad

Please sign in to comment.