artirix_data_models 0.7.4 → 0.7.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa6f5772ecb4d8d0bc6258f56a166b5ebe62e7dc
4
- data.tar.gz: e2275a8453167c0e1de2485c4d04bc9becaec434
3
+ metadata.gz: 820fdbf70691b6242e145718cc37914b07b629a5
4
+ data.tar.gz: b85426c590cd8760348f14a0d31a8f77d4fc143c
5
5
  SHA512:
6
- metadata.gz: 8a6b9cee47ab5baa3cb21bf081dc75a12df29788d1417a3f6450933347ee3ed858675ac1fd71f46a28e29aa4320b39305269e165f8982ec42e8af0b54c882014
7
- data.tar.gz: e3dae3ececb0ed6b70b2ef6276c1505eec5983085d9e622724d3b1fa1d83f2315ab1ac23a2448979bb4243a0281ac5927693c6a56550ab8cf73b0edf172ace55
6
+ metadata.gz: 2ecbfa86d86bbda5bc24960a1577f3c1040b90ba2196c85761f8641babf58a8a43fe34b093b8e1d39aedb1de7c6d81c46bf9f88c70c64ec05e22d6e0126d110c
7
+ data.tar.gz: c7915a3de805272c8562f6d843f562873240be251f278723e9e61935bb4dffd54159d4d806ab494a1b846bb1b12723631dc53363e5df7a64d1b3681e68c93b0e
data/README.md CHANGED
@@ -250,6 +250,10 @@ end
250
250
 
251
251
  ## Changes
252
252
 
253
+ ### 0.7.5
254
+
255
+ - `FakeResponseFactory` using given `_score` if > 0.
256
+
253
257
  ### 0.7.4
254
258
 
255
259
  - added `~> 3.4` to the `hashie` gem dependency
@@ -17,7 +17,9 @@ class ArtirixDataModels::FakeResponseFactory
17
17
  def self.response_by_results(result_hits, index_name: nil, document_type: nil, total_hits: nil, aggregations: [])
18
18
 
19
19
  total_hits ||= result_hits.size
20
- max_score = total_hits * 10.2
20
+
21
+ max_score = result_hits.map { |r| r.fetch(:_score, 0) }.max
22
+ max_score = max_score > 0 ? max_score : total_hits * 10.2
21
23
 
22
24
  build_response document_type: document_type,
23
25
  index_name: index_name,
@@ -75,9 +77,9 @@ class ArtirixDataModels::FakeResponseFactory
75
77
  {
76
78
  _index: hit.fetch(:_index, index_name),
77
79
  _type: hit.fetch(:_type, document_type),
78
- _id: hit[:id],
79
- _score: present_max_score - (index * 8.5),
80
- _source: hit.except(:_index, :_type)
80
+ _id: hit[:_id] || hit[:id],
81
+ _score: hit.fetch(:_score) { present_max_score - (index * 8.5) },
82
+ _source: hit.except(:_index, :_type, :_score, :_id)
81
83
  }
82
84
  end
83
85
  },
@@ -1,3 +1,3 @@
1
1
  module ArtirixDataModels
2
- VERSION = '0.7.4'
2
+ VERSION = '0.7.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artirix_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Turiño
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-11 00:00:00.000000000 Z
11
+ date: 2016-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport