diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2019-07-08 12:49:43 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2019-07-08 12:49:43 +0300 |
commit | 5214ad1a7f3720b8ea05f1fb99189d2be48f39ec (patch) | |
tree | 76dd9096ef6669886ae3d0c8d6b1a30a9bc91391 /app | |
parent | 43420a4b26e5901b853e8ef91463e1bc88af0bcb (diff) | |
parent | 4f04c4c90b2db8ddcf5f3e28a9bbefd20c8bbda0 (diff) |
Merge branch '40379-CJK-search-min-chars' into 'master'
Remove minimum required characters for fuzzy search if no trigram is used
See merge request gitlab-org/gitlab-ce!29810
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/issuable_finder.rb | 2 | ||||
-rw-r--r-- | app/models/concerns/issuable.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 3592505a977..f4fbeacfaba 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -429,7 +429,7 @@ class IssuableFinder items = klass.with(cte.to_arel).from(klass.table_name) end - items.full_search(search, matched_columns: params[:in]) + items.full_search(search, matched_columns: params[:in], use_minimum_char_limit: !use_cte_for_search?) end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 299e413321d..952de92cae1 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -168,7 +168,7 @@ module Issuable # matched_columns - Modify the scope of the query. 'title', 'description' or joining them with a comma. # # Returns an ActiveRecord::Relation. - def full_search(query, matched_columns: 'title,description') + def full_search(query, matched_columns: 'title,description', use_minimum_char_limit: true) allowed_columns = [:title, :description] matched_columns = matched_columns.to_s.split(',').map(&:to_sym) matched_columns &= allowed_columns @@ -176,7 +176,7 @@ module Issuable # Matching title or description if the matched_columns did not contain any allowed columns. matched_columns = [:title, :description] if matched_columns.empty? - fuzzy_search(query, matched_columns) + fuzzy_search(query, matched_columns, use_minimum_char_limit: use_minimum_char_limit) end def simple_sorts |