lsolr 0.1.0 → 0.1.1
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 +21 -22
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e75a43fc67a6ff02216d1c5b0d9fa6daeeee15ff9e5bcff47262de740325370
|
4
|
+
data.tar.gz: 05dc3a9fca1cf448cafd9a72929eb5c9749b3a79484a77c50530fe705415b6d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46405ec4cd25e20f6810b633a9a2526b1e2f58a733e46321b9560c917b552c3b2516da21cf1b8f03c483a761a5291646ea2eabe2ff7dfb1749fc6751f57bf20e
|
7
|
+
data.tar.gz: 1fce5e18a576157be0c77559633092a26adc601208b008078402072882318207d0852ce655f3bf13f9bdead3a4902f27c851cff8db40473c99b30e499c8ff6e0
|
data/lib/lsolr.rb
CHANGED
@@ -229,12 +229,7 @@ class LSolr
|
|
229
229
|
#
|
230
230
|
# @return [LSolr] self instance
|
231
231
|
def date_time_match(value)
|
232
|
-
value =
|
233
|
-
format_date(value)
|
234
|
-
else
|
235
|
-
clean(value, symbols: RESERVED_SYMBOLS - %w[- : . / +])
|
236
|
-
end
|
237
|
-
|
232
|
+
value = stringify(value, symbols: RESERVED_SYMBOLS - %w[- : . / +])
|
238
233
|
@value = %("#{value}")
|
239
234
|
self
|
240
235
|
end
|
@@ -289,8 +284,7 @@ class LSolr
|
|
289
284
|
#
|
290
285
|
# @return [LSolr] self instance
|
291
286
|
def greater_than(value)
|
292
|
-
|
293
|
-
@range_first = "#{GREATER_THAN}#{value}"
|
287
|
+
@range_first = "#{GREATER_THAN}#{stringify(value)}"
|
294
288
|
self
|
295
289
|
end
|
296
290
|
|
@@ -302,8 +296,7 @@ class LSolr
|
|
302
296
|
#
|
303
297
|
# @return [LSolr] self instance
|
304
298
|
def less_than(value)
|
305
|
-
|
306
|
-
@range_last = "#{value}#{LESS_THAN}"
|
299
|
+
@range_last = "#{stringify(value)}#{LESS_THAN}"
|
307
300
|
self
|
308
301
|
end
|
309
302
|
|
@@ -315,8 +308,7 @@ class LSolr
|
|
315
308
|
#
|
316
309
|
# @return [LSolr] self instance
|
317
310
|
def greater_than_or_equal_to(value)
|
318
|
-
|
319
|
-
@range_first = "#{GREATER_THAN_OR_EQUAL_TO}#{value}"
|
311
|
+
@range_first = "#{GREATER_THAN_OR_EQUAL_TO}#{stringify(value)}"
|
320
312
|
self
|
321
313
|
end
|
322
314
|
|
@@ -328,8 +320,7 @@ class LSolr
|
|
328
320
|
#
|
329
321
|
# @return [LSolr] self instance
|
330
322
|
def less_than_or_equal_to(value)
|
331
|
-
|
332
|
-
@range_last = "#{value}#{LESS_THAN_OR_EQUAL_TO}"
|
323
|
+
@range_last = "#{stringify(value)}#{LESS_THAN_OR_EQUAL_TO}"
|
333
324
|
self
|
334
325
|
end
|
335
326
|
|
@@ -384,14 +375,12 @@ class LSolr
|
|
384
375
|
.gsub(RESERVED_WORDS) { |match| "\\#{match}" }
|
385
376
|
end
|
386
377
|
|
387
|
-
def
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
head.operator = operator
|
394
|
-
another
|
378
|
+
def stringify(value, symbols: RESERVED_SYMBOLS - %w[- : . / + *])
|
379
|
+
if value.is_a?(Date) || value.is_a?(Time)
|
380
|
+
format_date(value)
|
381
|
+
else
|
382
|
+
clean(value, symbols: symbols)
|
383
|
+
end
|
395
384
|
end
|
396
385
|
|
397
386
|
def format_date(date)
|
@@ -405,4 +394,14 @@ class LSolr
|
|
405
394
|
|
406
395
|
"#{date.strftime('%Y-%m-%dT%H:%M:%S')}.#{msec_str}Z"
|
407
396
|
end
|
397
|
+
|
398
|
+
def link(another, operator)
|
399
|
+
return self if another.nil? || another.blank?
|
400
|
+
|
401
|
+
another = another.dup
|
402
|
+
head = another.head
|
403
|
+
head.prev = dup
|
404
|
+
head.operator = operator
|
405
|
+
another
|
406
|
+
end
|
408
407
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lsolr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taishi Kasuga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: LSolr is a query builder of Apache Solr standard Lucene type query for
|
14
14
|
Ruby.
|