Module: Krikri::RecordsHelper

Includes:
SearchResultsHelperBehavior
Defined in:
app/helpers/krikri/records_helper.rb

Instance Method Summary collapse

Methods included from SearchResultsHelperBehavior

#link_to_document, #render_bookmarks_control?, #render_enriched_record, #render_original_record, #render_thumbnail_tag

Instance Method Details

#random_record_id(provider_id) ⇒ String?

Return the id of a document randomly selected from the search index. selected document will belong to.

Parameters:

  • provider_id (String, nil)

    the id of the provider that the randomly

Returns:

  • (String, nil)

    the id of the randomly selected document. If none are available, gives ‘nil`



11
12
13
14
15
16
17
# File 'app/helpers/krikri/records_helper.rb', line 11

def random_record_id(provider_id)
  doc = Krikri::RandomSearchIndexDocumentBuilder.new do
    self.provider_id = provider_id
  end.document

  doc.present? ? local_name(doc.id) : nil
end