co-elastic-query 1.0.0 → 1.0.1
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 +9 -3
- 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: 272f832b729096f2ffc296f06276461db55df1ec
|
4
|
+
data.tar.gz: cc92ac8f7b830a06e6b6529800974b1c50a24802
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d094797eeb4d609456b156a1da5287740002f7865b933a5ba243c49f46f1cb32db68463e0139685aaf430ef5a122b0255d1c32208ce7268409ce3000f72c613e
|
7
|
+
data.tar.gz: 260883cc679078087afe9fa4dc89a1673adc89c2dee149d62d4c061ad443a8ccb2216bbbb63aedf13b4ee626ab4fe8dff505ac4edc5c53d8069b493fe66b4fda
|
data/lib/co-elastic-query.rb
CHANGED
@@ -246,10 +246,11 @@ class Elastic
|
|
246
246
|
SCORE = '_score'.freeze
|
247
247
|
INDEX = (ENV['ELASTIC_INDEX'] || 'default').freeze
|
248
248
|
|
249
|
-
def initialize(klass,
|
249
|
+
def initialize(klass, opts = {})
|
250
250
|
@klass = klass
|
251
251
|
@filter = klass.design_document
|
252
|
-
@index = index
|
252
|
+
@index = opts[:index] || INDEX
|
253
|
+
@use_couch_type = opts[:use_couch_type] || false
|
253
254
|
end
|
254
255
|
|
255
256
|
# Safely build the query
|
@@ -269,7 +270,12 @@ class Elastic
|
|
269
270
|
queries.unshift(opt[:query])
|
270
271
|
|
271
272
|
filters = opt[:filters] || []
|
272
|
-
|
273
|
+
|
274
|
+
if @use_couch_type
|
275
|
+
filters.unshift({term: {type: @filter}})
|
276
|
+
else
|
277
|
+
filters.unshift({type: {value: @filter}})
|
278
|
+
end
|
273
279
|
|
274
280
|
query = {
|
275
281
|
index: @index,
|
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.1
|
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-04-
|
12
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|