"code.gitea.io/gitea/models/unit"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/container"
+ "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
// Only show a repo that either has a topic or description.
subQueryCond := builder.NewCond()
- // Topic checking. Topics is non-null.
- subQueryCond = subQueryCond.Or(builder.And(builder.Neq{"topics": "null"}, builder.Neq{"topics": "[]"}))
+ // Topic checking. Topics are present.
+ if setting.Database.UsePostgreSQL { // postgres stores the topics as json and not as text
+ subQueryCond = subQueryCond.Or(builder.And(builder.NotNull{"topics"}, builder.Neq{"(topics)::text": "[]"}))
+ } else {
+ subQueryCond = subQueryCond.Or(builder.And(builder.Neq{"topics": "null"}, builder.Neq{"topics": "[]"}))
+ }
// Description checking. Description not empty.
subQueryCond = subQueryCond.Or(builder.Neq{"description": ""})