Commit 874ad681 authored by Razzeee's avatar Razzeee Committed by Rémy Coutable

Search should compare only the lowercase versions of the project names

parent 4bdcbc85
......@@ -111,6 +111,7 @@ v 8.12.0 (unreleased)
- Use default clone protocol on "check out, review, and merge locally" help page URL
- API for Ci Lint !5953 (Katarzyna Kobierska Urszula Budziszewska)
- Allow bulk update merge requests from merge requests index page
- Project search API is now agnostic to casing
v 8.11.6 (unreleased)
......
......@@ -430,7 +430,7 @@ module API
get "/search/:query" do
ids = current_user.authorized_projects.map(&:id)
visibility_levels = [ Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::PUBLIC ]
projects = Project.where("(id in (?) OR visibility_level in (?)) AND (name LIKE (?))", ids, visibility_levels, "%#{params[:query]}%")
projects = Project.where("(id in (?) OR visibility_level in (?)) AND (LOWER(name) LIKE LOWER((?)))", ids, visibility_levels, "%#{params[:query]}%")
sort = params[:sort] == 'desc' ? 'desc' : 'asc'
projects = case params["order_by"]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment