summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-11-24 12:24:24 +0100
committerDouwe Maan <douwe@selenight.nl>2017-11-27 11:29:40 +0100
commitda42dfb3cf4a2fb0cdcc1a3b41438516a0bed0e5 (patch)
tree1dc5014e27ce049e47e8670b83b79e0c49bb96b9 /app/models/concerns
parentd4eea275310867eccc927d0e92a1d19a165f0668 (diff)
downloadgitlab-ce-dm-search-pattern.tar.gz
Use fuzzy search with minimum length of 3 characters where appropriatedm-search-pattern
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 176ce1152f1..81706a5fc4b 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 = fuzzy_arel_match(: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 = fuzzy_arel_match(:title, query)
- description = fuzzy_arel_match(:description, query)
-
- where(title&.or(description))
+ fuzzy_search(query, [:title, :description])
end
def sort(method, excluded_labels: [])