Class: RelatonBsi::HitCollection
- Inherits:
-
RelatonBib::HitCollection
- Object
- RelatonBib::HitCollection
- RelatonBsi::HitCollection
- Defined in:
- lib/relaton_bsi/hit_collection.rb
Overview
Page of hit collection.
Constant Summary collapse
- DOMAIN =
"https://shop.bsigroup.com"
Instance Method Summary collapse
-
#filter_hits!(code_parts) ⇒ self
Filter the search results for a BSI standard.
-
#initialize(reference, year = nil) ⇒ HitCollection
constructor
Initialize a new HitCollection.
Constructor Details
#initialize(reference, year = nil) ⇒ HitCollection
Initialize a new HitCollection.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/relaton_bsi/hit_collection.rb', line 17 def initialize(reference, year = nil) super reference, year config = Algolia::Search::Config.new( application_id: "575YE157G9", api_key: "a057b4e74099445df2eddb7940828a10", ) client = Algolia::Search::Client.new config, logger: ::Logger.new($stderr) index = client.init_index "shopify_products" ref = text.sub(/ExComm|Expert commentary/, "Ex") resp = index.search ref # , facetFilters: "product_type:standard" @array = create_hits resp[:hits] end |
Instance Method Details
#filter_hits!(code_parts) ⇒ self
Filter the search results for a BSI standard.
37 38 39 40 41 42 43 |
# File 'lib/relaton_bsi/hit_collection.rb', line 37 def filter_hits!(code_parts) hits = filter code_parts hits = filter code_parts, skip_rest: true if hits.empty? hits = filter code_parts, drop_amd: true if hits.empty? @array = hits self end |