Sha256: 67ca6a0bac401451957d8699ef512dfbfc0d8c37e7203a5d5b0720ae73bcc464

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true
module PrependedLinkedData::SearchQuery
  # Override Qa::Authorities::LinkedData::SearchQuery#search method
  # @return [String] json results for search query
  def search(query, language: nil, replacements: {}, subauth: nil, context: false, performance_data: false) # rubocop:disable Metrics/ParameterLists
    saved_performance_data = performance_data
    performance_data = true
    full_results = super
    return full_results unless full_results.is_a?(Hash) && full_results.key?(:performance)
    QaServer::PerformanceHistory.save_result(dt_stamp: Time.now.getlocal,
                                             authority: authority_name,
                                             action: 'search',
                                             size_bytes: full_results[:performance][:fetched_bytes],
                                             load_time_ms: (full_results[:performance][:fetch_time_s] * 1000),
                                             normalization_time_ms: (full_results[:performance][:normalization_time_s] * 1000))
    saved_performance_data ? full_results : full_results[:results]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qa_server-2.2.3 app/prepends/prepended_linked_data/search_query.rb