server/tags: fix retrieving many tags
This commit is contained in:
parent
77bf3bdc3c
commit
0014721053
|
@ -209,10 +209,13 @@ def get_tags_by_names(names: List[str]) -> List[model.Tag]:
|
||||||
names = util.icase_unique(names)
|
names = util.icase_unique(names)
|
||||||
if len(names) == 0:
|
if len(names) == 0:
|
||||||
return []
|
return []
|
||||||
expr = sa.sql.false()
|
return (db.session.query(model.Tag)
|
||||||
for name in names:
|
.join(model.TagName)
|
||||||
expr = expr | (sa.func.lower(model.TagName.name) == name.lower())
|
.filter(
|
||||||
return db.session.query(model.Tag).join(model.TagName).filter(expr).all()
|
sa.sql.or_(
|
||||||
|
sa.func.lower(model.TagName.name) == name.lower()
|
||||||
|
for name in names))
|
||||||
|
.all())
|
||||||
|
|
||||||
|
|
||||||
def get_or_create_tags_by_names(
|
def get_or_create_tags_by_names(
|
||||||
|
|
Loading…
Reference in New Issue