Module: PrependedLinkedData::SearchQuery

Defined in:
app/prepends/prepended_linked_data/search_query.rb

Instance Method Summary collapse

Instance Method Details

#search(query, language: nil, replacements: {}, subauth: nil, context: false, performance_data: false) ⇒ String

Override Qa::Authorities::LinkedData::SearchQuery#search method

Returns:

  • (String) —

    json results for search query



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/prepends/prepended_linked_data/search_query.rb', line 5

def search(query, language: nil, replacements: {}, subauth: nil, context: false, performance_data: false) # rubocop:disable Metrics/ParameterLists
  start_time_s = Time.now.to_f

  saved_performance_data = performance_data
  performance_data = true
  ph_record = QaServer::PerformanceHistory.create_record(authority: authority_name, action: 'search')
  @phid = ph_record.id
  begin
    full_results = super
    update_performance_history_record(full_results, start_time_s)
  rescue Exception => e # rubocop:disable Lint/RescueException
    ph_record.destroy
    raise e
  end
  saved_performance_data || !full_results.key?(:results) ? full_results : full_results[:results]
end