lsolr 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lsolr.rb +16 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5209c6df0afed03c107799afd32286c6f1e2c5fb
|
4
|
+
data.tar.gz: 2f621984e15a5472db655670cc615c263b39b8db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30a21016fb99353993723f424d3a0d875d86b042361fa3c39a0154f961e0d0806c96047e92c92bc6775f7b4fcd8a04150b8368447bc9b58c126840e28cf3b2ff
|
7
|
+
data.tar.gz: 85f2ab04086bc0f6d965348188b545448e2c86ed0ea52d731de37fc95adbdeb7a65fc76c155a044e20bad7fab47f2138d734aeecd6c53bd995b13dae4430b198
|
data/lib/lsolr.rb
CHANGED
@@ -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
|
-
|
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
|