lsolr 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lsolr.rb +16 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05c41bbf755a942358b8103e341c059d3a062da1
4
- data.tar.gz: 0a74f0bb97acf6dcc385433964d90cba915b84c0
3
+ metadata.gz: 5209c6df0afed03c107799afd32286c6f1e2c5fb
4
+ data.tar.gz: 2f621984e15a5472db655670cc615c263b39b8db
5
5
  SHA512:
6
- metadata.gz: b97854d45e33b3f03dc64f1a985a892d3a94169d7a2a14d0970d9adb926094dbcc21cda9e878f4f5f7cd40678ddf2071bd8d5624312981f73926260b882eeb2a
7
- data.tar.gz: 6e18db2a61a038353498e3cd4c1992a51e510d517aeecb448c05a4cb96321f08e046839ff58c48909fb4f338bfc9c4deaece64bdfd5f9fc73d5bb99749b0d4ae
6
+ metadata.gz: 30a21016fb99353993723f424d3a0d875d86b042361fa3c39a0154f961e0d0806c96047e92c92bc6775f7b4fcd8a04150b8368447bc9b58c126840e28cf3b2ff
7
+ data.tar.gz: 85f2ab04086bc0f6d965348188b545448e2c86ed0ea52d731de37fc95adbdeb7a65fc76c155a044e20bad7fab47f2138d734aeecd6c53bd995b13dae4430b198
@@ -152,10 +152,8 @@ class LSolr
152
152
  def to_s # rubocop:disable Metrics/AbcSize
153
153
  raise IncompleteQueryError, 'Please specify search field and value.' if blank?
154
154
 
155
- return @raw unless @raw.empty?
156
-
157
- @value = "#{@range_first} #{TO} #{@range_last}" if range_search?
158
- expr = "#{expr_not}#{left_parentheses.join}#{@field}:#{@value}#{right_parentheses.join}"
155
+ expr = build_term_expr
156
+ expr = "#{expr_not}#{left_parentheses.join}#{expr}#{right_parentheses.join}"
159
157
  expr = "#{prev} #{operator} #{expr}" if !prev.nil? && prev.present?
160
158
  "#{expr}#{@boost}"
161
159
  end
@@ -397,6 +395,10 @@ class LSolr
397
395
  @value.empty? && !@range_first.empty? && !@range_last.empty?
398
396
  end
399
397
 
398
+ def raw?
399
+ !@raw.empty?
400
+ end
401
+
400
402
  def clean(value, symbols: RESERVED_SYMBOLS)
401
403
  value.to_s
402
404
  .tr(symbols.join, REPLACEMENT_CHAR)
@@ -432,4 +434,14 @@ class LSolr
432
434
  head.operator = operator
433
435
  another
434
436
  end
437
+
438
+ def build_term_expr
439
+ if raw?
440
+ @raw
441
+ elsif range_search?
442
+ "#{@field}:#{@range_first} #{TO} #{@range_last}"
443
+ else
444
+ "#{@field}:#{@value}"
445
+ end
446
+ end
435
447
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lsolr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga