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, document|
98
- duplicate_index = index_of_duplicate_document(documents, document)
99
- if duplicate_index && (documents[duplicate_index][:fields][:timestamp] < document[:fields][:timestamp])
100
- documents[duplicate_index] = document
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 << document
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[:docid] == document_to_index[:docid]
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
 
@@ -1,3 +1,3 @@
1
1
  module IndexTanked
2
- GEM_VERSION = '0.4.0'
2
+ GEM_VERSION = '0.4.1'
3
3
  end
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: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adam Kittelson