cauchy 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cauchy/index_schema/normalization.rb +25 -17
- data/lib/cauchy/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d08afcae445ff25b3d59b8f8d1362e0ee6af672b
|
4
|
+
data.tar.gz: 4f34c2abe722c7fb89a13d0c84aa63a654d7ae4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 879d10050c250276d941c9a43caa1bec30e7eb0d541b1206672705f888aaf7913c45bbaf23c06722b21597bd22913120d7a7a7007a00a763d8e5d95b1b0a8410
|
7
|
+
data.tar.gz: 994491e4b86f87854906e52ec3933825c5611c2190cd089b508ce90ad2b3bc2deb357b2e7d1be8848486e961643e0c4b00445d5e9066333442f328a725caed67
|
@@ -12,28 +12,36 @@ module Cauchy
|
|
12
12
|
|
13
13
|
def normalize_mapping(hash)
|
14
14
|
hash.deep_stringify_keys.sort.map do |key, field|
|
15
|
-
if field.
|
16
|
-
|
17
|
-
|
15
|
+
if field.is_a?(Hash)
|
16
|
+
normalize_field(key, field)
|
17
|
+
else
|
18
|
+
[key, field]
|
18
19
|
end
|
20
|
+
end.to_h
|
21
|
+
end
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
+
def normalize_field(key, field)
|
24
|
+
if field.key?('properties')
|
25
|
+
field['properties'] = normalize_mapping(field['properties'])
|
26
|
+
field['type'] ||= 'object'
|
27
|
+
end
|
23
28
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
29
|
+
if field['type'] == 'date'
|
30
|
+
field['format'] ||= 'dateOptionalTime'
|
31
|
+
end
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
33
|
+
if ['boolean', 'long', 'double', 'date'].include?(field['type'])
|
34
|
+
field.delete('analyzer')
|
35
|
+
field['index'] ||= 'not_analyzed'
|
36
|
+
end
|
34
37
|
|
35
|
-
|
36
|
-
|
38
|
+
if key == 'properties'
|
39
|
+
field = normalize_mapping(field)
|
40
|
+
else
|
41
|
+
field = normalize_value(field)
|
42
|
+
end
|
43
|
+
|
44
|
+
return [key, field]
|
37
45
|
end
|
38
46
|
|
39
47
|
def normalize_settings(hash)
|
data/lib/cauchy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cauchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Hamera
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
256
|
version: '0'
|
257
257
|
requirements: []
|
258
258
|
rubyforge_project:
|
259
|
-
rubygems_version: 2.
|
259
|
+
rubygems_version: 2.6.13
|
260
260
|
signing_key:
|
261
261
|
specification_version: 4
|
262
262
|
summary: An elasticsearch schema management tool
|