index-tanked 0.1.8 → 0.1.9
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/index-tanked/active_record_defaults/class_methods.rb +1 -0
- data/lib/index-tanked/active_record_defaults/instance_companion.rb +12 -0
- data/lib/index-tanked/active_record_defaults/instance_methods.rb +6 -0
- data/lib/index-tanked/index_tanked.rb +0 -3
- data/lib/index-tanked/version.rb +1 -1
- metadata +4 -4
@@ -16,6 +16,7 @@ module IndexTanked
|
|
16
16
|
count = 0
|
17
17
|
find_in_batches(options) do |instances|
|
18
18
|
documents = instances.map { |instance| instance.index_tanked.document_for_batch_addition }
|
19
|
+
documents = documents.flatten.compact
|
19
20
|
count += documents.size
|
20
21
|
index_tanked.retry_on_error(:times => 5, :delay_multiplier => 2) do
|
21
22
|
index_tanked.index.batch_insert(documents)
|
@@ -31,6 +31,18 @@ module IndexTanked
|
|
31
31
|
@companion.class.index_tanked.dependent_fields.any?{|field| @companion.send("#{field}_changed?") }
|
32
32
|
end
|
33
33
|
|
34
|
+
def document_for_batch_addition
|
35
|
+
ancestor = @companion.class._ancestors_to_index.first
|
36
|
+
if ancestor
|
37
|
+
documents = []
|
38
|
+
documents << super
|
39
|
+
documents << @companion.becomes(ancestor).index_tanked.document_for_batch_addition if ancestor
|
40
|
+
documents.flatten.compact
|
41
|
+
else
|
42
|
+
super
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
34
46
|
end
|
35
47
|
end
|
36
48
|
end
|
@@ -4,6 +4,12 @@ module IndexTanked
|
|
4
4
|
def index_tanked
|
5
5
|
@index_tanked ||= InstanceCompanion.new(self)
|
6
6
|
end
|
7
|
+
|
8
|
+
def add_to_index_tank
|
9
|
+
self.class.add_to_index_tank(index_tanked.doc_id, index_tanked.data)
|
10
|
+
ancestor = self.class._ancestors_to_index.first
|
11
|
+
self.becomes(ancestor).add_to_index_tank if ancestor
|
12
|
+
end
|
7
13
|
end
|
8
14
|
end
|
9
15
|
end
|
data/lib/index-tanked/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: index-tanked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Kittelson
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-03-
|
19
|
+
date: 2011-03-24 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|