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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6201d8ff96b8b7a0f832da3f041ce68d1e7c13e
4
- data.tar.gz: 301ecffff574afe0c610b239d504a25d54e9d0e7
3
+ metadata.gz: 272f832b729096f2ffc296f06276461db55df1ec
4
+ data.tar.gz: cc92ac8f7b830a06e6b6529800974b1c50a24802
5
5
  SHA512:
6
- metadata.gz: 036bc57e784220cddae897e99ef50834508c24fccf6c1a215d392a3a90fa23971cbe89e6204a740f2042529de9df025452a4b59881c7d1136d6258779ecad60a
7
- data.tar.gz: c42ef837af6e2deceba86a782fcd8ac1c075032f55b5e1854f9bd3ed5fefacf4ac8c29e0cf71bbde12de9ace5e273f6642608035a75e914a720f23a3b1b120df
6
+ metadata.gz: d094797eeb4d609456b156a1da5287740002f7865b933a5ba243c49f46f1cb32db68463e0139685aaf430ef5a122b0255d1c32208ce7268409ce3000f72c613e
7
+ data.tar.gz: 260883cc679078087afe9fa4dc89a1673adc89c2dee149d62d4c061ad443a8ccb2216bbbb63aedf13b4ee626ab4fe8dff505ac4edc5c53d8069b493fe66b4fda
@@ -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, index = INDEX)
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
- filters.unshift({type: {value: @filter}})
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,
@@ -1,3 +1,3 @@
1
1
  module CoElasticQuery
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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.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-20 00:00:00.000000000 Z
12
+ date: 2015-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler