elastics-client 1.1.3 → 1.1.4

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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/elastics/template.rb +22 -9
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3
1
+ 1.1.4
@@ -63,15 +63,28 @@ module Elastics
63
63
  # in case of a syntax error it will remove all the problematic characters and retry with a cleaned query_string
64
64
  # http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/queryparsersyntax.html
65
65
  def try_clean_and_retry(vars)
66
- response_vars = request(vars)
67
- if !Prunable::VALUES.include?(vars[:cleanable_query]) && Conf.http_client.raise_proc.call(response_vars[3])
68
- e = HttpError.new(response_vars[3], caller_line)
69
- e.to_hash['error'] =~ /^SearchPhaseExecutionException/
70
- (vars[:cleanable_query].is_a?(String) ? vars[:cleanable_query] : vars[:cleanable_query][:query]).tr!('"&|!(){}[]~^:+-\\', '')
71
- request vars
72
- else
73
- response_vars
74
- end
66
+ response_vars = request(vars)
67
+ if !Prunable::VALUES.include?(vars[:cleanable_query].is_a?(Hash) ?
68
+ vars[:cleanable_query][:query] :
69
+ vars[:cleanable_query]) && Conf.http_client.raise_proc.call(response_vars[3])
70
+ e = HttpError.new(response_vars[3], caller_line)
71
+ e.to_hash['error'] =~ /^SearchPhaseExecutionException/
72
+ # remove problematic characters
73
+ (vars[:cleanable_query].is_a?(Hash) ? vars[:cleanable_query][:query] : vars[:cleanable_query]).tr!('"&|!(){}[]~^:+-\\', '')
74
+ # if after the cleanup is prunable, then we remove it now so #interpolate could use the eventual default
75
+ if Prunable::VALUES.include?(vars[:cleanable_query].is_a?(Hash) ?
76
+ vars[:cleanable_query][:query] :
77
+ vars[:cleanable_query])
78
+ if vars[:cleanable_query].is_a?(Hash)
79
+ vars[:cleanable_query].delete(:query)
80
+ else
81
+ vars.delete(:cleanable_query)
82
+ end
83
+ end
84
+ request vars
85
+ else
86
+ response_vars
87
+ end
75
88
  end
76
89
 
77
90
  def request(vars)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastics-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-17 00:00:00.000000000 Z
12
+ date: 2013-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json