Skip to content

Commit ca6fb00

Browse files
davidsvantessontechknowlogick
authored andcommitted
Change repo search to use exact match for topic search. (#7941)
Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
1 parent 4ea9a37 commit ca6fb00

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

models/repo_list.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ func SearchRepositoryByName(opts *SearchRepoOptions) (RepositoryList, int64, err
248248
// separate keyword
249249
var subQueryCond = builder.NewCond()
250250
for _, v := range strings.Split(opts.Keyword, ",") {
251-
subQueryCond = subQueryCond.Or(builder.Like{"topic.name", strings.ToLower(v)})
251+
if opts.TopicOnly {
252+
subQueryCond = subQueryCond.Or(builder.Eq{"topic.name": strings.ToLower(v)})
253+
} else {
254+
subQueryCond = subQueryCond.Or(builder.Like{"topic.name", strings.ToLower(v)})
255+
}
252256
}
253257
subQuery := builder.Select("repo_topic.repo_id").From("repo_topic").
254258
Join("INNER", "topic", "topic.id = repo_topic.topic_id").

0 commit comments

Comments
 (0)