diff options
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r-- | app/controllers/search_controller.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 1ca34dee3d6..a3c6499bc54 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -3,18 +3,18 @@ class SearchController < ApplicationController include ControllerWithCrossProjectAccessCheck include SearchHelper - include RedisTracking + include ProductAnalyticsTracking include ProductAnalyticsTracking include SearchRateLimitable RESCUE_FROM_TIMEOUT_ACTIONS = [:count, :show, :autocomplete, :aggregations].freeze CODE_SEARCH_LITERALS = %w[blob: extension: path: filename:].freeze - track_custom_event :show, - name: 'i_search_total', - label: 'redis_hll_counters.search.search_total_unique_counts_monthly', - action: 'executed', - destinations: [:redis_hll, :snowplow] + track_event :show, + name: 'i_search_total', + label: 'redis_hll_counters.search.search_total_unique_counts_monthly', + action: 'executed', + destinations: [:redis_hll, :snowplow] def self.search_rate_limited_endpoints %i[show count autocomplete] @@ -24,7 +24,6 @@ class SearchController < ApplicationController before_action :block_anonymous_global_searches, :check_scope_global_search_enabled, except: :opensearch skip_before_action :authenticate_user! - skip_before_action :default_cache_headers, only: :count requires_cross_project_access if: -> do search_term_present = params[:search].present? || params[:term].present? @@ -33,9 +32,6 @@ class SearchController < ApplicationController before_action :check_search_rate_limit!, only: search_rate_limited_endpoints before_action only: :show do - push_frontend_feature_flag(:search_blobs_language_aggregation, current_user) - end - before_action only: :show do update_scope_for_code_search end rescue_from ActiveRecord::QueryCanceled, with: :render_timeout @@ -116,6 +112,9 @@ class SearchController < ApplicationController @ref = params[:project_ref] if params[:project_ref].present? @filter = params[:filter] + # Cache the response on the frontend + expires_in 1.minute + render json: Gitlab::Json.dump(search_autocomplete_opts(term, filter: @filter)) end |