thinking-sphinx-allen 1.3.18.1 → 1.3.18.2

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.
@@ -301,6 +301,7 @@ module ThinkingSphinx
301
301
  end
302
302
 
303
303
  def add_sphinx_callbacks_and_extend(delta = false)
304
+ return unless ThinkingSphinx.delta_by_thinking_sphinx?
304
305
  unless indexed_by_sphinx?
305
306
  after_destroy :toggle_deleted
306
307
 
@@ -127,6 +127,15 @@ module ThinkingSphinx
127
127
  Thread.current[:thinking_sphinx_deltas_enabled] = value
128
128
  end
129
129
 
130
+
131
+ def self.delta_by_thinking_sphinx?
132
+ Thread.current[:delta_by_thinking_sphinx].nil? ? true : Thread.current[:delta_by_thinking_sphinx]
133
+ end
134
+
135
+ # index delta by thinking_sphinx, especially active_record callbacks
136
+ def self.delta_by_thinking_sphinx=(value)
137
+ Thread.current[:delta_by_thinking_sphinx] = value
138
+ end
130
139
  # Check if updates are enabled. True by default, unless within the test
131
140
  # environment.
132
141
  #
@@ -46,6 +46,20 @@ describe ThinkingSphinx do
46
46
  ThinkingSphinx.define_indexes?.should be_true
47
47
  end
48
48
  end
49
+
50
+ describe '.delta_by_thinking_sphinx' do
51
+ it "should delta by thinking_sphinx by default" do
52
+ ThinkingSphinx.delta_by_thinking_sphinx = nil
53
+ ThinkingSphinx.delta_by_thinking_sphinx?.should be_true
54
+ end
55
+ end
56
+
57
+ describe '.delta_by_thinking_sphinx=' do
58
+ it "should disable delta_by_thinking_sphinx" do
59
+ ThinkingSphinx.delta_by_thinking_sphinx = false
60
+ ThinkingSphinx.delta_by_thinking_sphinx?.should be_false
61
+ end
62
+ end
49
63
 
50
64
  describe '.deltas_enabled?' do
51
65
  it "should index deltas by default" do
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 1
7
7
  - 3
8
8
  - 18
9
- - 1
10
- version: 1.3.18.1
9
+ - 2
10
+ version: 1.3.18.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pat Allan