lsolr 0.2.5 → 1.0.0
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.
- checksums.yaml +5 -5
- data/lib/lsolr.rb +14 -13
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 72ca65e76238b682c58290896a7adf22ea8bc33d113c8dc1ae54297b48f5483a
|
4
|
+
data.tar.gz: 4552840e3133ffa77d69732fddf30923a806cb60c1b22dc12c9db02199e18735
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbc33e53020289eba40180b28e85df35ebfa64fa4d8e8ded93d0999eff5ce5001273267bf8c13eaa89a661d662e6d674e3d30223247bcc5bde1b102ef4750575
|
7
|
+
data.tar.gz: cd5ae5819e137b42b7a648344bc9c6656095d1a5374e4ba38624c32867ba779d3a9f683dee0f294af63f3126843db213c75512cdb23759687d1a348c135c6f47
|
data/lib/lsolr.rb
CHANGED
@@ -98,7 +98,7 @@ class LSolr
|
|
98
98
|
PARENTHESIS_RIGHT = ')'
|
99
99
|
|
100
100
|
RESERVED_SYMBOLS = %w(- + & | ! ( ) { } [ ] ^ " ~ * ? : \\\\ /).freeze
|
101
|
-
RESERVED_WORDS = /(AND|OR|NOT)
|
101
|
+
RESERVED_WORDS = /(AND|OR|NOT)/.freeze
|
102
102
|
REPLACEMENT_CHAR = ' '
|
103
103
|
|
104
104
|
attr_accessor :prev, :operator, :left_parentheses, :right_parentheses, :expr_not
|
@@ -385,6 +385,7 @@ class LSolr
|
|
385
385
|
# @raise [LSolr::ArgumentError] if specified distance is out of range
|
386
386
|
def fuzzy_match(value, distance: 2.0)
|
387
387
|
raise ArgumentError, "Out of #{RANGE_FUZZY_MATCH_DISTANCE}. `#{distance}` given." unless valid_fuzzy_match_distance?(distance)
|
388
|
+
|
388
389
|
@value = "#{clean(value).split.join}#{PROXIMITY}#{distance}"
|
389
390
|
self
|
390
391
|
end
|
@@ -486,28 +487,28 @@ class LSolr
|
|
486
487
|
!@raw.empty?
|
487
488
|
end
|
488
489
|
|
489
|
-
def present_string?(
|
490
|
-
!
|
490
|
+
def present_string?(val)
|
491
|
+
!val.nil? && (val.is_a?(String) || val.is_a?(Symbol)) && !val.empty?
|
491
492
|
end
|
492
493
|
|
493
|
-
def present_array?(
|
494
|
-
!
|
494
|
+
def present_array?(val)
|
495
|
+
!val.nil? && val.is_a?(Array) && !val.compact.empty? && val.map(&:to_s).map(&:empty?).none?
|
495
496
|
end
|
496
497
|
|
497
|
-
def present_query?(
|
498
|
-
!
|
498
|
+
def present_query?(val)
|
499
|
+
!val.nil? && val.present?
|
499
500
|
end
|
500
501
|
|
501
|
-
def valid_boost_factor?(
|
502
|
-
(
|
502
|
+
def valid_boost_factor?(val)
|
503
|
+
(val.is_a?(Float) || val.is_a?(Integer)) && val > 0
|
503
504
|
end
|
504
505
|
|
505
|
-
def valid_score?(
|
506
|
-
|
506
|
+
def valid_score?(val)
|
507
|
+
val.is_a?(Float) || val.is_a?(Integer)
|
507
508
|
end
|
508
509
|
|
509
|
-
def valid_fuzzy_match_distance?(
|
510
|
-
(
|
510
|
+
def valid_fuzzy_match_distance?(val)
|
511
|
+
(val.is_a?(Float) || val.is_a?(Integer)) && RANGE_FUZZY_MATCH_DISTANCE.member?(val)
|
511
512
|
end
|
512
513
|
|
513
514
|
def clean(value, symbols: RESERVED_SYMBOLS)
|
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.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taishi Kasuga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: LSolr is a query builder for Apache Solr in Ruby. It supports only the
|
14
14
|
standard query.
|
@@ -30,15 +30,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.4.0
|
34
34
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
36
|
- - ">="
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: '0'
|
39
39
|
requirements: []
|
40
|
-
|
41
|
-
rubygems_version: 2.6.13
|
40
|
+
rubygems_version: 3.0.3
|
42
41
|
signing_key:
|
43
42
|
specification_version: 4
|
44
43
|
summary: A query builder for Apache Solr in Ruby
|