Class: Relaton::Xsf::HitCollection

Inherits:
Core::HitCollection
  • Object
show all
Defined in:
lib/relaton/xsf/hit_collection.rb

Constant Summary collapse

GHDATA_URL =
"https://raw.githubusercontent.com/relaton/relaton-data-xsf/data-v2/".freeze

Instance Method Summary collapse

Instance Method Details

#indexObject



15
16
17
18
19
20
21
# File 'lib/relaton/xsf/hit_collection.rb', line 15

def index
  @index ||= Relaton::Index.find_or_create(
    :xsf,
    url: "#{GHDATA_URL}#{INDEXFILE}.zip",
    file: "#{INDEXFILE}.yaml",
  )
end

#searchObject



6
7
8
9
10
11
12
13
# File 'lib/relaton/xsf/hit_collection.rb', line 6

def search
  @array = index.search(ref).sort_by { |hit| hit[:id] }.map do |row|
    Hit.new url: "#{GHDATA_URL}#{row[:file]}"
  end
  self
rescue StandardError => e
  raise Relaton::RequestError, e.message
end