Module: PrependedLinkedData::SearchQuery

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

Instance Method Summary collapse

Instance Method Details

#search(query, request_header: {}, 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
21
22
# File 'app/prepends/prepended_linked_data/search_query.rb', line 5

def search(query, request_header: {}, language: nil, replacements: {}, subauth: nil, context: false, performance_data: false) # rubocop:disable Metrics/ParameterLists
  return super if QaServer.config.suppress_performance_gathering

  start_time_s = QaServer.current_time_s
  request_header = build_request_header(language: language, replacements: replacements, subauth: subauth, context: context, performance_data: performance_data) if request_header.empty?
  saved_performance_data = performance_data || request_header[:performance_data]
  request_header[:performance_data] = true

  @phid = QaServer.config.performance_cache.new_entry(authority: authority_name, action: 'search')
  begin
    full_results = super
    update_performance_history_record(full_results, start_time_s)
  rescue Exception => e # rubocop:disable Lint/RescueException
    QaServer.config.performance_cache.destroy(@phid)
    raise e
  end
  requested_results(full_results, saved_performance_data)
end