ryansch-ts-resque-delta 1.1.5.2 → 1.1.5.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -91,8 +91,43 @@ class ThinkingSphinx::Deltas::ResqueDelta::DeltaJob
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def self.filter_flag_as_deleted_ids(ids, index)
|
94
|
-
ThinkingSphinx.
|
95
|
-
|
96
|
-
|
94
|
+
config = ThinkingSphinx::Configuration.instance
|
95
|
+
client = config.client
|
96
|
+
client.open
|
97
|
+
|
98
|
+
search_results = []
|
99
|
+
partition_ids(ids, 4096) do |subset|
|
100
|
+
search_results += ThinkingSphinx.search_for_ids(
|
101
|
+
:with => {:@id => subset}, :index => index, :client => client
|
102
|
+
).results[:matches].collect { |match| match[:doc] }
|
103
|
+
client.reset
|
104
|
+
end
|
105
|
+
|
106
|
+
client.close
|
107
|
+
|
108
|
+
search_results
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.partition_ids(ids, n)
|
112
|
+
if n > 0 && n < ids.size
|
113
|
+
result = []
|
114
|
+
max_subarray_size = n - 1
|
115
|
+
i = j = 0
|
116
|
+
while i < ids.size && j < ids.size
|
117
|
+
j = i + max_subarray_size
|
118
|
+
result << ids.slice(i..j)
|
119
|
+
i += n
|
120
|
+
end
|
121
|
+
else
|
122
|
+
result = ids
|
123
|
+
end
|
124
|
+
|
125
|
+
if block_given?
|
126
|
+
result.each do |ary|
|
127
|
+
yield ary
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
result
|
97
132
|
end
|
98
133
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ryansch-ts-resque-delta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 69
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
9
|
- 5
|
10
|
-
-
|
11
|
-
version: 1.1.5.
|
10
|
+
- 3
|
11
|
+
version: 1.1.5.3
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Aaron Gibralter
|