cijef-fullname-matcher 2.1.0 → 2.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/fullname/matcher/core.rb +6 -5
- data/lib/fullname/matcher/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52ca7d5a38684258b4a0751f38ef97c28b480f21
|
4
|
+
data.tar.gz: 6df28e86affd0ade3cdfb1c9fe2f13a6348234e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99b2cfc7a3cb4e519921725743316e422de294120587891ce3b9bd0d02833540312311bb575c8fef37526fa4e25221e50c34804cc662c19cbc702cd28c7f77b6
|
7
|
+
data.tar.gz: 1ca0631e8fce8d6a2f24080527cf838b60657358b7672085f7ba8f0fcd1604a0ce90ce9dfb273cec426e14fd1d944b2dd33f16beba7078171c50556f37745685
|
@@ -32,7 +32,8 @@ module Fullname::Matcher
|
|
32
32
|
DEFAULT_OPTIONS = {
|
33
33
|
:skip_match_middle_name => false, # skip match middle name if middle name not provided.
|
34
34
|
:null_middle_name_match_allowed => false,
|
35
|
-
:skip_match_suffix => false
|
35
|
+
:skip_match_suffix => false, # skip match suffix if suffix not provided or no column suffix in database.
|
36
|
+
:null_suffix_match_allowed => false
|
36
37
|
}
|
37
38
|
|
38
39
|
class Error < StandardError ; end
|
@@ -75,7 +76,7 @@ module Fullname::Matcher
|
|
75
76
|
exact_match_list = match_list.select do |r|
|
76
77
|
compare_without_dot(r.send(@mapping[:middle]), name[:middle]) && compare_without_dot(r.send(@mapping[:suffix]), name[:suffix])
|
77
78
|
end
|
78
|
-
return exact_match_list if exact_match_list.size > 0 && @options[:null_middle_name_match_allowed] == false
|
79
|
+
#return exact_match_list if exact_match_list.size > 0 && @options[:null_middle_name_match_allowed] == false && @options[:null_suffix_match_allowed] == false
|
79
80
|
|
80
81
|
# 2. if name[:middle] is not NULL, regexp match
|
81
82
|
if name[:middle]
|
@@ -92,7 +93,7 @@ module Fullname::Matcher
|
|
92
93
|
match_list = []
|
93
94
|
else
|
94
95
|
# 2.2 fuzzy match: assume all matches since name[:middle] is NULL
|
95
|
-
return match_list
|
96
|
+
return (@options[:null_middle_name_match_allowed] == false && @options[:null_suffix_match_allowed] == false) ? exact_match_list : match_list
|
96
97
|
end
|
97
98
|
end
|
98
99
|
|
@@ -170,12 +171,12 @@ module Fullname::Matcher
|
|
170
171
|
|
171
172
|
# exactly match suffix
|
172
173
|
if name[:suffix].present?
|
173
|
-
matched_list_with_suffix = matched_list.select{|r| compare_without_dot(r.send(@mapping[:suffix]), name[:suffix]) }
|
174
|
+
matched_list_with_suffix = matched_list.select{|r| (compare_without_dot(r.send(@mapping[:suffix]), name[:suffix]) || (r.send(@mapping[:suffix]).blank? && @options[:null_suffix_match_allowed])) }
|
174
175
|
return matched_list_with_suffix if matched_list_with_suffix.size > 0
|
175
176
|
end
|
176
177
|
|
177
178
|
# fuzzy match suffix( NULL matches NON-NULL )
|
178
|
-
return matched_list.select{|r| r.send(@mapping[:suffix]).to_s.strip.empty? || name[:suffix].nil? }
|
179
|
+
# return matched_list.select{|r| r.send(@mapping[:suffix]).to_s.strip.empty? || name[:suffix].nil? }
|
179
180
|
|
180
181
|
end
|
181
182
|
return matched_list
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cijef-fullname-matcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yegang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fullname-parser
|