Allow to filter repositories by language in explore, user and organization repositories lists (#18430)
This commit is contained in:
parent
401e5c8174
commit
604ce77628
6 changed files with 43 additions and 11 deletions
|
@ -136,6 +136,8 @@ type SearchRepoOptions struct {
|
|||
Archived util.OptionalBool
|
||||
// only search topic name
|
||||
TopicOnly bool
|
||||
// only search repositories with specified primary language
|
||||
Language string
|
||||
// include description in keyword search
|
||||
IncludeDescription bool
|
||||
// None -> include has milestones AND has no milestone
|
||||
|
@ -439,6 +441,13 @@ func SearchRepositoryCondition(opts *SearchRepoOptions) builder.Cond {
|
|||
cond = cond.And(keywordCond)
|
||||
}
|
||||
|
||||
if opts.Language != "" {
|
||||
cond = cond.And(builder.In("id", builder.
|
||||
Select("repo_id").
|
||||
From("language_stat").
|
||||
Where(builder.Eq{"language": opts.Language}).And(builder.Eq{"is_primary": true})))
|
||||
}
|
||||
|
||||
if opts.Fork != util.OptionalBoolNone {
|
||||
cond = cond.And(builder.Eq{"is_fork": opts.Fork == util.OptionalBoolTrue})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue