mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Change repo search to use exact match for topic search. (#7941)
Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
This commit is contained in:
		
				
					committed by
					
						
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							4ea9a377db
						
					
				
				
					commit
					ca6fb004ac
				
			@@ -248,8 +248,12 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (RepositoryList, int64, err
 | 
			
		||||
		// separate keyword
 | 
			
		||||
		var subQueryCond = builder.NewCond()
 | 
			
		||||
		for _, v := range strings.Split(opts.Keyword, ",") {
 | 
			
		||||
			if opts.TopicOnly {
 | 
			
		||||
				subQueryCond = subQueryCond.Or(builder.Eq{"topic.name": strings.ToLower(v)})
 | 
			
		||||
			} else {
 | 
			
		||||
				subQueryCond = subQueryCond.Or(builder.Like{"topic.name", strings.ToLower(v)})
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		subQuery := builder.Select("repo_topic.repo_id").From("repo_topic").
 | 
			
		||||
			Join("INNER", "topic", "topic.id = repo_topic.topic_id").
 | 
			
		||||
			Where(subQueryCond).
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user