co-elastic-query 1.0.10 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/co-elastic-query.rb +10 -32
- data/lib/co-elastic-query/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b80018d1bc9d22c63decb9c5d6e58741071738d
|
4
|
+
data.tar.gz: a0b7b36f8d9a1ff825e05d99ee527f041d8ed28e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c370b38fbea198853744bc643cd85aab3a588515e912ffe9f97b7219577c862dbd72395f03e925a57c033d70004632949f848b2a4e3bf20eb1439d799addae50
|
7
|
+
data.tar.gz: 5f7520cccf1e5c88d669b79419f2f39729f2d16454efed12589ccf5b2df885e29fa15a97ca1fc32848a152397a80681eb03bdbee62673c67963946950f77c068
|
data/lib/co-elastic-query.rb
CHANGED
@@ -19,7 +19,7 @@ class Elastic
|
|
19
19
|
end
|
20
20
|
|
21
21
|
|
22
|
-
attr_accessor :offset, :limit, :sort, :fields
|
22
|
+
attr_accessor :offset, :limit, :sort, :fields
|
23
23
|
|
24
24
|
def raw_filter(filter)
|
25
25
|
@raw_filter ||= []
|
@@ -47,12 +47,6 @@ class Elastic
|
|
47
47
|
self
|
48
48
|
end
|
49
49
|
|
50
|
-
def and_filter(filters)
|
51
|
-
@andFilter ||= {}
|
52
|
-
@andFilter.merge!(filters)
|
53
|
-
self
|
54
|
-
end
|
55
|
-
|
56
50
|
# Applys the query to child objects
|
57
51
|
def has_child(name)
|
58
52
|
@hasChild = name
|
@@ -119,20 +113,6 @@ class Elastic
|
|
119
113
|
end
|
120
114
|
end
|
121
115
|
|
122
|
-
if @andFilter
|
123
|
-
fieldfilters ||= []
|
124
|
-
fieldfilter = { :and => [] }
|
125
|
-
andArray = fieldfilter[:and]
|
126
|
-
|
127
|
-
@andFilter.each do |key, value|
|
128
|
-
build_filter(andArray, key, value)
|
129
|
-
end
|
130
|
-
|
131
|
-
unless andArray.empty?
|
132
|
-
fieldfilters.push(fieldfilter)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
116
|
if @rangeFilter
|
137
117
|
fieldfilters ||= []
|
138
118
|
|
@@ -145,9 +125,9 @@ class Elastic
|
|
145
125
|
fieldfilters ||= []
|
146
126
|
|
147
127
|
@nots.each do |key, value|
|
148
|
-
fieldfilter = { :
|
149
|
-
build_filter(fieldfilter[:not][:or], key, value)
|
150
|
-
unless fieldfilter[:not].empty?
|
128
|
+
fieldfilter = { not: { filter: { or: [] } } }
|
129
|
+
build_filter(fieldfilter[:not][:filter][:or], key, value)
|
130
|
+
unless fieldfilter[:not][:filter][:or].empty?
|
151
131
|
fieldfilters.push(fieldfilter)
|
152
132
|
end
|
153
133
|
end
|
@@ -190,10 +170,6 @@ class Elastic
|
|
190
170
|
}
|
191
171
|
}]
|
192
172
|
|
193
|
-
if @query_settings
|
194
|
-
should[0][:simple_query_string].merge! @query_settings
|
195
|
-
end
|
196
|
-
|
197
173
|
if @hasChild
|
198
174
|
should << {
|
199
175
|
has_child: {
|
@@ -377,10 +353,12 @@ class Elastic
|
|
377
353
|
body: {
|
378
354
|
sort: sort,
|
379
355
|
query: {
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
356
|
+
bool: {
|
357
|
+
must: {
|
358
|
+
query: {
|
359
|
+
bool: {
|
360
|
+
must: queries
|
361
|
+
}
|
384
362
|
}
|
385
363
|
},
|
386
364
|
filter: {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: co-elastic-query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen von Takach
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|