Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r--app/controllers/search_controller.rb34
1 files changed, 25 insertions, 9 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index 7d251ba555c..7a7e63f5fc4 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -9,7 +9,7 @@ class SearchController < ApplicationController
RESCUE_FROM_TIMEOUT_ACTIONS = [:count, :show, :autocomplete].freeze
- track_redis_hll_event :show, name: 'i_search_total'
+ track_event :show, name: 'i_search_total', destinations: [:redis_hll, :snowplow]
around_action :allow_gitaly_ref_name_caching
@@ -42,13 +42,19 @@ class SearchController < ApplicationController
@sort = params[:sort] || default_sort
@search_service = Gitlab::View::Presenter::Factory.new(search_service, current_user: current_user).fabricate!
- @scope = @search_service.scope
- @without_count = @search_service.without_count?
- @show_snippets = @search_service.show_snippets?
- @search_results = @search_service.search_results
- @search_objects = @search_service.search_objects
- @search_highlight = @search_service.search_highlight
- @aggregations = @search_service.search_aggregations
+
+ @search_level = @search_service.level
+ @search_type = search_type
+
+ @global_search_duration_s = Benchmark.realtime do
+ @scope = @search_service.scope
+ @without_count = @search_service.without_count?
+ @show_snippets = @search_service.show_snippets?
+ @search_results = @search_service.search_results
+ @search_objects = @search_service.search_objects
+ @search_highlight = @search_service.search_highlight
+ @aggregations = @search_service.search_aggregations
+ end
increment_search_counters
end
@@ -144,7 +150,9 @@ class SearchController < ApplicationController
payload[:metadata]['meta.search.filters.state'] = params[:state]
payload[:metadata]['meta.search.force_search_results'] = params[:force_search_results]
payload[:metadata]['meta.search.project_ids'] = params[:project_ids]
- payload[:metadata]['meta.search.search_level'] = params[:search_level]
+ payload[:metadata]['meta.search.type'] = @search_type if @search_type.present?
+ payload[:metadata]['meta.search.level'] = @search_level if @search_level.present?
+ payload[:metadata][:global_search_duration_s] = @global_search_duration_s if @global_search_duration_s.present?
if search_service.abuse_detected?
payload[:metadata]['abuse.confidence'] = Gitlab::Abuse.confidence(:certain)
@@ -203,6 +211,14 @@ class SearchController < ApplicationController
render status: :request_timeout
end
end
+
+ def tracking_namespace_source
+ search_service.project&.namespace || search_service.group
+ end
+
+ def search_type
+ 'basic'
+ end
end
SearchController.prepend_mod_with('SearchController')