elos 1.0.16 → 1.0.17

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: a7d31b68839dfd6de47dc55dfd864836782cdc92
4
- data.tar.gz: 2b1b66f0e8a64c6db1c00e6db59598cf690bfd38
3
+ metadata.gz: 6ff3008e40d503964c422631fad5d77de60a7885
4
+ data.tar.gz: 466ffd95f2b4c692dbc3e72af3c38b05917c40d7
5
5
  SHA512:
6
- metadata.gz: c1c7c854e2e603f9a6e8b940f32ae5a10ca418929964428b6805fbc1c174d09da486c662ff04476b0596996c99ca06515b90d04ad3661412f40c15c797505ebb
7
- data.tar.gz: 0db04d2376b97469be902158dac7e79d776ecfe6de0e33bba2cfeed0c916e606d6a249c1cc9755982a234310787c4671a59bb75e2cf8f923056b1f686394adbc
6
+ metadata.gz: c413e33ee7e80fe240836c337bfa1803fde01c621578d235d36d13a1cb079d9ab55e5185e3119aaf53a619185b3e1f40b29a9c0b8d2b8940f3ac5e80c876ecd6
7
+ data.tar.gz: 507bb34e5aad52e3308bdd4aac681f373bb40639ad08a2409c6ae4d9b79ff274dc4d27a8f63ed1cde4b8138aed887b93a21cd7b49041163724159b96585c7750
data/lib/elos/criteria.rb CHANGED
@@ -61,7 +61,7 @@ class Elos::Criteria < Elos::Result
61
61
  end
62
62
 
63
63
  def query
64
- @query_builder_class.new(@params)._build
64
+ @query_builder_class.new(@params.merge(class: @klass)).wrap_build
65
65
  end
66
66
 
67
67
  protected
@@ -17,6 +17,7 @@ module Elos::Index::Indexable
17
17
  def index(obj, destroy: false, unindex: false)
18
18
  if !unindex && data = index_data.(obj)
19
19
  data.merge!(_destroyed: destroy)
20
+ data[:json] = data[:json].to_json if data[:json]
20
21
  params = { index: write_alias_name, type: type_name, body: data }
21
22
  params.merge!(id: obj.id) if obj.id
22
23
  client.index(params)['_id']
@@ -18,7 +18,7 @@ module Elos::Index::Mappings
18
18
 
19
19
  def set_mappings(mappings)
20
20
  mps = mappings.is_a?(Proc) ? mappings.() : mappings.deep_dup
21
- mps[:properties].merge!(_destroyed: boolean_property, json: no_index_string_property)
21
+ mps[:properties].merge!(_destroyed: boolean_property, json: no_index_string_property) if respond_to?(:physically_destroy?) && physically_destroy?
22
22
  self.mappings = { type_name => mps }
23
23
  end
24
24
  end
@@ -3,11 +3,13 @@ class Elos::QueryBuilder::Base
3
3
  include Elos::QueryBuilder::Queries
4
4
 
5
5
  def initialize(params)
6
+ @klass = params.delete(:class)
6
7
  @params = params
7
8
  end
8
9
 
9
- def _build
10
+ def wrap_build
10
11
  query = build
12
+ return query if !@klass.respond_to?(:physically_destroy?) || @klass.physically_destroy?
11
13
  original_query = query[:query]
12
14
  filter = term_filter(:_destroyed, value: false)
13
15
  query[:query] = { filtered: { query: original_query, filter: filter } }
data/lib/elos/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Elos
2
- VERSION = '1.0.16'
2
+ VERSION = '1.0.17'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tetsuri Moriya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-06 00:00:00.000000000 Z
11
+ date: 2015-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport