Class: RelatonCcsds::HitCollection

Inherits:
RelatonBib::HitCollection
  • Object
show all
Defined in:
lib/relaton_ccsds/hit_collection.rb

Constant Summary collapse

GHURL =
"https://raw.githubusercontent.com/relaton/relaton-data-ccsds/main/".freeze
INDEX_FILE =
"index-v1.yaml".freeze

Instance Method Summary collapse

Instance Method Details

#fetch<Type>

Search his in index.

Returns:

  • (<Type>)

    <description>



11
12
13
14
15
16
17
# File 'lib/relaton_ccsds/hit_collection.rb', line 11

def fetch
  rows = index.search text
  @array = rows.map { |row| Hit.new code: row[:id], url: "#{GHURL}#{row[:file]}" }
  self
rescue SocketError, OpenURI::HTTPError, OpenSSL::SSL::SSLError, Errno::ECONNRESET => e
  raise RelatonBib::RequestError, e.message
end

#indexObject



19
20
21
# File 'lib/relaton_ccsds/hit_collection.rb', line 19

def index
  @index ||= Relaton::Index.find_or_create :ccsds, url: "#{GHURL}index-v1.zip", file: INDEX_FILE
end