Commit e540498f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'project_search_case_insensitive' into 'master'

Make search for projects case insensitive

### What does this MR do?

This MR makes the search for projects case insensitive.

### Why was this MR needed?
Currently the search for projects is case sensitive.
You can test this on gitlab.com with the search string "perforce" for example.
* perforce returns 2 projects
* Perforce returns 5 projects
* PERFORCE returns 0 projects

This makes it harder to find the projects you are looking for.
With this MR users can find more projects, since they don't need to worry about not seeing some projects just because of an upper letter.

@dblessing Can you take a look at this? :)

See merge request !296
parents ad18f91e 1e9e3fc7
......@@ -2,7 +2,7 @@ Note: The upcoming release contains empty lines to reduce the number of merge co
v 7.8.0
- Replace highlight.js with rouge-fork rugments (Stefan Tatschner)
-
- Make project search case insensitive (Hannes Rosenögger)
-
- Expose description in groups API
-
......
......@@ -183,7 +183,7 @@ class Project < ActiveRecord::Base
end
def search(query)
joins(:namespace).where("projects.archived = ?", false).where("projects.name LIKE :query OR projects.path LIKE :query OR namespaces.name LIKE :query OR projects.description LIKE :query", query: "%#{query}%")
joins(:namespace).where("projects.archived = ?", false).where("LOWER(projects.name) LIKE :query OR LOWER(projects.path) LIKE :query OR LOWER(namespaces.name) LIKE :query OR LOWER(projects.description) LIKE :query", query: "%#{query.downcase}%")
end
def search_by_title(query)
......
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