aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-03-16 16:55:19 -0400
committerUnknwon <u@gogs.io>2016-03-16 16:55:19 -0400
commitff731ea07dd695fc49dc2e1e158e47867a613379 (patch)
treefb38c2710e85da28a7ea37e973e4ba0dda9c5633 /models
parent9a5a27ea8d855e8724ebb066a40e43a7dea119f5 (diff)
downloadgitea-ff731ea07dd695fc49dc2e1e158e47867a613379.tar.gz
gitea-ff731ea07dd695fc49dc2e1e158e47867a613379.zip
#2814 LOWER() column value within search
Diffstat (limited to 'models')
-rw-r--r--models/repo.go2
-rw-r--r--models/user.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/models/repo.go b/models/repo.go
index abe67a6d8e..2f8019feed 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -1520,7 +1520,7 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, _ int
repos = make([]*Repository, 0, opts.PageSize)
// Append conditions
- sess := x.Where("lower_name like ?", "%"+opts.Keyword+"%")
+ sess := x.Where("LOWER(lower_name) LIKE ?", "%"+opts.Keyword+"%")
if opts.OwnerID > 0 {
sess.And("owner_id = ?", opts.OwnerID)
}
diff --git a/models/user.go b/models/user.go
index a1d1f3b211..e6717aecdf 100644
--- a/models/user.go
+++ b/models/user.go
@@ -1140,8 +1140,8 @@ func SearchUserByName(opts *SearchUserOptions) (users []*User, _ int64, _ error)
searchQuery := "%" + opts.Keyword + "%"
users = make([]*User, 0, opts.PageSize)
// Append conditions
- sess := x.Where("lower_name like ?", searchQuery).
- Or("full_name like ?", searchQuery).
+ sess := x.Where("LOWER(lower_name) LIKE ?", searchQuery).
+ Or("LOWER(full_name) LIKE ?", searchQuery).
And("type = ?", opts.Type)
var countSess xorm.Session