Class: RelatonXsf::HitCollection
- Inherits:
-
RelatonBib::HitCollection
- Object
- RelatonBib::HitCollection
- RelatonXsf::HitCollection
- Defined in:
- lib/relaton_xsf/hit_collection.rb
Constant Summary collapse
- INDEX_FILE =
"index-v1.yaml".freeze
- GHDATA_URL =
"https://raw.githubusercontent.com/relaton/relaton-data-xsf/main/".freeze
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
15 16 17 |
# File 'lib/relaton_xsf/hit_collection.rb', line 15 def index @index ||= Relaton::Index.find_or_create :xsf, url: "#{GHDATA_URL}index-v1.zip", file: INDEX_FILE end |
#search ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/relaton_xsf/hit_collection.rb', line 6 def search @array = index.search(text).sort_by { |hit| hit[:id] }.map do |row| Hit.new url: "#{GHDATA_URL}#{row[:file]}" end self rescue StandardError => e raise RelatonBib::RequestError, e. end |