diff options
author | Sean McGivern <sean@gitlab.com> | 2019-01-25 16:22:34 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-01-25 16:22:34 +0300 |
commit | dfa31d5f2fa4a6c71c992710b9d1786707b4c912 (patch) | |
tree | 0494d10254b2f608d8f48917abe486a346363647 /app/models/milestone.rb | |
parent | 04c9ab3183610017b8c2803b6a48a597fb86d8c1 (diff) | |
parent | 22eb2e4c227b060981bb37708222cdd07e825542 (diff) |
Merge branch '54905-milestone-search' into 'master'
Resolve "Milestone search"
Closes #54905
See merge request gitlab-org/gitlab-ce!24265
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r-- | app/models/milestone.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 8efaf87ca3a..26cfdc5ef30 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -77,7 +77,7 @@ class Milestone < ActiveRecord::Base alias_attribute :name, :title class << self - # Searches for milestones matching the given query. + # Searches for milestones with a matching title or description. # # This method uses ILIKE on PostgreSQL and LIKE on MySQL. # @@ -88,6 +88,17 @@ class Milestone < ActiveRecord::Base fuzzy_search(query, [:title, :description]) end + # Searches for milestones with a matching title. + # + # This method uses ILIKE on PostgreSQL and LIKE on MySQL. + # + # query - The search query as a String + # + # Returns an ActiveRecord::Relation. + def search_title(query) + fuzzy_search(query, [:title]) + end + def filter_by_state(milestones, state) case state when 'closed' then milestones.closed |