mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	#2814 LOWER() column value within search
This commit is contained in:
		@@ -3,7 +3,7 @@ Gogs - Go Git Service [
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##### Current version: 0.9.11
 | 
					##### Current version: 0.9.12
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Web | UI  | Preview  |
 | 
					| Web | UI  | Preview  |
 | 
				
			||||||
|:-------------:|:-------:|:-------:|
 | 
					|:-------------:|:-------:|:-------:|
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							@@ -17,7 +17,7 @@ import (
 | 
				
			|||||||
	"github.com/gogits/gogs/modules/setting"
 | 
						"github.com/gogits/gogs/modules/setting"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const APP_VER = "0.9.11.0316"
 | 
					const APP_VER = "0.9.12.0316"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
						runtime.GOMAXPROCS(runtime.NumCPU())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1520,7 +1520,7 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, _ int
 | 
				
			|||||||
	repos = make([]*Repository, 0, opts.PageSize)
 | 
						repos = make([]*Repository, 0, opts.PageSize)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Append conditions
 | 
						// Append conditions
 | 
				
			||||||
	sess := x.Where("lower_name like ?", "%"+opts.Keyword+"%")
 | 
						sess := x.Where("LOWER(lower_name) LIKE ?", "%"+opts.Keyword+"%")
 | 
				
			||||||
	if opts.OwnerID > 0 {
 | 
						if opts.OwnerID > 0 {
 | 
				
			||||||
		sess.And("owner_id = ?", opts.OwnerID)
 | 
							sess.And("owner_id = ?", opts.OwnerID)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1140,8 +1140,8 @@ func SearchUserByName(opts *SearchUserOptions) (users []*User, _ int64, _ error)
 | 
				
			|||||||
	searchQuery := "%" + opts.Keyword + "%"
 | 
						searchQuery := "%" + opts.Keyword + "%"
 | 
				
			||||||
	users = make([]*User, 0, opts.PageSize)
 | 
						users = make([]*User, 0, opts.PageSize)
 | 
				
			||||||
	// Append conditions
 | 
						// Append conditions
 | 
				
			||||||
	sess := x.Where("lower_name like ?", searchQuery).
 | 
						sess := x.Where("LOWER(lower_name) LIKE ?", searchQuery).
 | 
				
			||||||
		Or("full_name like ?", searchQuery).
 | 
							Or("LOWER(full_name) LIKE ?", searchQuery).
 | 
				
			||||||
		And("type = ?", opts.Type)
 | 
							And("type = ?", opts.Type)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var countSess xorm.Session
 | 
						var countSess xorm.Session
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1 +1 @@
 | 
				
			|||||||
0.9.11.0316
 | 
					0.9.12.0316
 | 
				
			||||||
		Reference in New Issue
	
	Block a user