lib/relaton_ieee/hit_collection.rb in relaton-ieee-1.7.4 vs lib/relaton_ieee/hit_collection.rb in relaton-ieee-1.7.5
- old
+ new
@@ -21,10 +21,10 @@
resp = Faraday.get url
resp_json = JSON.parse resp.body
json = JSON.parse resp_json["message"]
@array = json["response"]["searchResults"]["resultsMapList"]
.reduce([]) do |s, hit|
- /^(?:\w+\s)?(?<id>[^-\/]+)(-(?<year>\d{4}))?/ =~ hit["record"]["recordTitle"]
+ /^(?:\w+\s)?(?<id>[A-Z\d\.]+)(-(?<year>\d{4}))?/ =~ hit["record"]["recordTitle"]
next s unless id && code =~ %r{^#{id}}
s << Hit.new(hit["record"].merge(code: id, year: year.to_i), self)
end.sort_by { |h| h.hit[:year].to_s + h.hit["recordURL"] }.reverse
end