acts_as_background_solr 0.5 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README +7 -0
  2. data/history.txt +4 -0
  3. data/lib/solr_batch.rb +5 -4
  4. metadata +3 -2
data/README CHANGED
@@ -27,6 +27,13 @@ Use this in place of acts_as_solr as in your models, e.g.
27
27
 
28
28
  acts_as_background_solr
29
29
 
30
+ Example:
31
+
32
+ require 'acts_as_background_solr'
33
+ class User < ActiveRecord::Base
34
+ acts_as_background_solr
35
+ end
36
+
30
37
  The options :background, :if and :auto_commit will be automatically
31
38
  overridden.
32
39
 
data/history.txt ADDED
@@ -0,0 +1,4 @@
1
+ 0.5.1
2
+
3
+ * Fix bugs in argument parsing related to do_optimize and do_commit
4
+ in SolrBatch.process_all. Thanks to pablo@handwire.com.
data/lib/solr_batch.rb CHANGED
@@ -11,7 +11,7 @@ class SolrBatch
11
11
  models.each do |model|
12
12
  klass = eval(model)
13
13
  first_klass = klass unless first_klass
14
- SolrBatch.sync_pending_records(klass, { :do_commit => false, :do_optimize => true })
14
+ SolrBatch.sync_pending_records(klass, { :do_commit => false, :do_optimize => false })
15
15
  end
16
16
 
17
17
  ## Commit/optimize after ALL records have been processed
@@ -41,10 +41,11 @@ class SolrBatch
41
41
  # Ex: from within ActiveRecord Model, call:
42
42
  # SolrBatch.sync_pending_records(self, { :batch_size => 500 } );
43
43
  def SolrBatch.sync_pending_records(ar_model, opts = {}, iteration=1)
44
+ opts = { :batch_size => 500, :do_commit => true, :do_optimize => true }.merge(opts)
44
45
  batch_size = opts.delete(:batch_size)
45
- batch_size = 500 if batch_size.nil? || batch_size < 1
46
- do_commit = opts.delete(:do_commit) || true
47
- do_optimize = opts.delete(:do_optimize) || true
46
+ batch_size = 500 if batch_size < 1
47
+ do_commit = opts.delete(:do_commit)
48
+ do_optimize = opts.delete(:do_optimize)
48
49
  raise "Invalid option keys: #{opts.keys}" unless opts.keys.size == 0
49
50
 
50
51
  RAILS_DEFAULT_LOGGER.debug("SolrBatch.sync_pending_records(#{ar_model})")
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: acts_as_background_solr
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.5"
7
- date: 2007-09-09 00:00:00 -04:00
6
+ version: 0.5.1
7
+ date: 2007-11-06 00:00:00 -05:00
8
8
  summary: Extends the functionality of the acts_as_solr plugin to provide for disconnected background job processing
9
9
  require_paths:
10
10
  - lib
@@ -30,6 +30,7 @@ authors:
30
30
  - Michael Bryzek
31
31
  files:
32
32
  - init.rb
33
+ - history.txt
33
34
  - lib/acts_as_background_solr.rb
34
35
  - lib/class_methods.rb
35
36
  - lib/instance_methods.rb