From 3f18ea2816dd5e99e80e05fa93043d0d02f3d54c Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Fri, 25 Jun 2021 14:59:48 +0200 Subject: [PATCH] Key:lit should not match lit=no --- matcher/api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/matcher/api.py b/matcher/api.py index 7450b27..7ccd27e 100644 --- a/matcher/api.py +++ b/matcher/api.py @@ -1,4 +1,4 @@ -from sqlalchemy import func, or_ +from sqlalchemy import func, or_, and_ from sqlalchemy.orm import selectinload from matcher import model, database, wikidata_api, wikidata from matcher.data import extra_keys @@ -237,7 +237,8 @@ def get_tag_filter(cls, tag_list): tag_filter = [] for tag_or_key in tag_list: if tag_or_key.startswith("Key:"): - tag_filter.append(cls.tags.has_key(tag_or_key[4:])) + tag_filter.append(and_(cls.tags.has_key(tag_or_key[4:]), + cls.tags[tag_or_key[4:]] != 'no')) if tag_or_key.startswith("Tag:"): k, _, v = tag_or_key.partition("=") tag_filter.append(cls.tags[k[4:]] == v)