summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-11-29 09:10:43 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-11-29 09:10:43 +0000
commita4f8dddc212fcd91f6a4a09e92b2de6117a21305 (patch)
treeeed31a76289f865cdb1d392c6bad3f2bf96ebbc4 /app/models/concerns
parent3659327d71a033703451baba01873d5663755739 (diff)
parentda42dfb3cf4a2fb0cdcc1a3b41438516a0bed0e5 (diff)
downloadgitlab-ce-a4f8dddc212fcd91f6a4a09e92b2de6117a21305.tar.gz
Merge branch 'dm-search-pattern' into 'master'
Use fuzzy search with minimum length of 3 characters where appropriate Closes #40512 See merge request gitlab-org/gitlab-ce!15592
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/issuable.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 27cd3118f81..5ca4a7086cb 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -122,9 +122,7 @@ module Issuable
#
# Returns an ActiveRecord::Relation.
def search(query)
- title = to_fuzzy_arel(:title, query)
-
- where(title)
+ fuzzy_search(query, [:title])
end
# Searches for records with a matching title or description.
@@ -135,10 +133,7 @@ module Issuable
#
# Returns an ActiveRecord::Relation.
def full_search(query)
- title = to_fuzzy_arel(:title, query)
- description = to_fuzzy_arel(:description, query)
-
- where(title&.or(description))
+ fuzzy_search(query, [:title, :description])
end
def sort(method, excluded_labels: [])