diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-14 21:08:31 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-14 21:08:31 +0300 |
commit | 92f95ccac81911d1fcc32e999a7f1ce04624a56c (patch) | |
tree | ad207e86b7858ae93a085fbdc04155f5cd469620 /app/controllers/search_controller.rb | |
parent | 85e494935a8726dc98bb19ffa584488420e5011e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r-- | app/controllers/search_controller.rb | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index b6e24a450e8..04d2b3068da 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -5,9 +5,6 @@ class SearchController < ApplicationController include SearchHelper include RendersCommits - NON_ES_SEARCH_TERM_LIMIT = 64 - NON_ES_SEARCH_CHAR_LIMIT = 4096 - around_action :allow_gitaly_ref_name_caching skip_before_action :authenticate_user! @@ -68,19 +65,13 @@ class SearchController < ApplicationController private def search_term_valid? - return true if Gitlab::CurrentSettings.elasticsearch_search? - - chars_count = params[:search].length - if chars_count > NON_ES_SEARCH_CHAR_LIMIT - flash[:alert] = t('errors.messages.search_chars_too_long', count: NON_ES_SEARCH_CHAR_LIMIT) - + unless search_service.valid_query_length? + flash[:alert] = t('errors.messages.search_chars_too_long', count: SearchService::SEARCH_CHAR_LIMIT) return false end - search_terms_count = params[:search].split.count { |word| word.length >= 3 } - if search_terms_count > NON_ES_SEARCH_TERM_LIMIT - flash[:alert] = t('errors.messages.search_terms_too_long', count: NON_ES_SEARCH_TERM_LIMIT) - + unless search_service.valid_terms_count? + flash[:alert] = t('errors.messages.search_terms_too_long', count: SearchService::SEARCH_TERM_LIMIT) return false end |