index-tanked 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -94,12 +94,14 @@ module IndexTanked
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def self.remove_duplicate_documents(documents)
|
97
|
-
documents.inject([]) do |documents,
|
98
|
-
duplicate_index = index_of_duplicate_document(documents,
|
99
|
-
if duplicate_index
|
100
|
-
documents[duplicate_index]
|
97
|
+
documents.inject([]) do |documents, document_record|
|
98
|
+
duplicate_index = index_of_duplicate_document(documents, document_record)
|
99
|
+
if duplicate_index
|
100
|
+
if documents[duplicate_index].created_at < document_record.created_at
|
101
|
+
documents[duplicate_index] = document_record
|
102
|
+
end
|
101
103
|
else
|
102
|
-
documents <<
|
104
|
+
documents << document_record
|
103
105
|
end
|
104
106
|
documents
|
105
107
|
end
|
@@ -107,7 +109,7 @@ module IndexTanked
|
|
107
109
|
|
108
110
|
def self.index_of_duplicate_document(document_array, document_to_index)
|
109
111
|
document_array.index do |doc|
|
110
|
-
doc
|
112
|
+
(doc.record_id == document_to_index.record_id) && (doc.model_name == document_to_index.model_name)
|
111
113
|
end
|
112
114
|
end
|
113
115
|
|
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: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Kittelson
|