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.
- data/lib/thinking_sphinx/active_record.rb +1 -0
- data/lib/thinking_sphinx.rb +9 -0
- data/spec/thinking_sphinx_spec.rb +14 -0
- metadata +2 -2
data/lib/thinking_sphinx.rb
CHANGED
@@ -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
|