co-elastic-query 1.0.5 → 1.0.6
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 +4 -4
- data/lib/co-elastic-query.rb +14 -7
- data/lib/co-elastic-query/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: a252f8562630b0a0d3241d4073ee19a8ed90145b
|
4
|
+
data.tar.gz: f5392cc5b35e261ecf9a973da1a40efb7623d640
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cfbfbecd60ddc4e7f89b269afa0a4d25a5ebe22d188afa1978183786802c52419b10a69aec9ae9f35ed1442f161e819e81f47064d91b6ac001b3ae10836a0f5
|
7
|
+
data.tar.gz: abf22384ebb70f7c5b030179b023126e2a10697f8fb063f14da1b06fccd0c1752c752f034f868ab89f148d94dafd877ee50aa9beb2ff1beb46a1242be563fc99
|
data/lib/co-elastic-query.rb
CHANGED
@@ -7,6 +7,7 @@ class Elastic
|
|
7
7
|
|
8
8
|
@filters = nil
|
9
9
|
@search = "#{query[:q]}*"
|
10
|
+
@fields = ['_all'.freeze]
|
10
11
|
|
11
12
|
@limit = query[:limit] || 20
|
12
13
|
@limit = @limit.to_i
|
@@ -18,9 +19,7 @@ class Elastic
|
|
18
19
|
end
|
19
20
|
|
20
21
|
|
21
|
-
attr_accessor :offset
|
22
|
-
attr_accessor :limit
|
23
|
-
attr_accessor :sort
|
22
|
+
attr_accessor :offset, :limit, :sort, :fields
|
24
23
|
|
25
24
|
def raw_filter(filter)
|
26
25
|
@raw_filter ||= []
|
@@ -28,6 +27,10 @@ class Elastic
|
|
28
27
|
self
|
29
28
|
end
|
30
29
|
|
30
|
+
def search_field(field)
|
31
|
+
@fields.unshift(field)
|
32
|
+
end
|
33
|
+
|
31
34
|
|
32
35
|
# filters is in the form {fieldname1: ['var1','var2',...], fieldname2: ['var1','var2'...]}
|
33
36
|
# NOTE:: may overwrite an existing filter in merge
|
@@ -161,7 +164,8 @@ class Elastic
|
|
161
164
|
if @hasChild || @hasParent
|
162
165
|
should = [{
|
163
166
|
simple_query_string: {
|
164
|
-
query: @search
|
167
|
+
query: @search,
|
168
|
+
fields: @fields
|
165
169
|
}
|
166
170
|
}]
|
167
171
|
|
@@ -171,7 +175,8 @@ class Elastic
|
|
171
175
|
type: @hasChild,
|
172
176
|
query: {
|
173
177
|
simple_query_string: {
|
174
|
-
query: @search
|
178
|
+
query: @search,
|
179
|
+
fields: @fields
|
175
180
|
}
|
176
181
|
}
|
177
182
|
}
|
@@ -184,7 +189,8 @@ class Elastic
|
|
184
189
|
parent_type: @hasParent,
|
185
190
|
query: {
|
186
191
|
simple_query_string: {
|
187
|
-
query: @search
|
192
|
+
query: @search,
|
193
|
+
fields: @fields
|
188
194
|
}
|
189
195
|
}
|
190
196
|
}
|
@@ -205,7 +211,8 @@ class Elastic
|
|
205
211
|
query_obj = {
|
206
212
|
query: {
|
207
213
|
simple_query_string: {
|
208
|
-
query: @search
|
214
|
+
query: @search,
|
215
|
+
fields: @fields
|
209
216
|
}
|
210
217
|
},
|
211
218
|
filters: fieldfilters,
|
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: 1.0.
|
4
|
+
version: 1.0.6
|
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: 2015-08-
|
12
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.4.
|
91
|
+
rubygems_version: 2.4.6
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Elasticsearch query generator
|