mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
fix field searching and negated field searching
This commit is contained in:
parent
e3f64c0f07
commit
2ba5f80cf1
1 changed files with 4 additions and 2 deletions
|
@ -258,7 +258,7 @@ flds %s like :_text_%d escape '\\')""" % (extra, c, extra, c))
|
||||||
self.lims['valid'] = False
|
self.lims['valid'] = False
|
||||||
return
|
return
|
||||||
# gather nids
|
# gather nids
|
||||||
regex = value.replace("%", ".*")
|
regex = value.replace("_", ".").replace("%", ".*")
|
||||||
nids = []
|
nids = []
|
||||||
for (id,mid,flds) in self.col.db.execute("""
|
for (id,mid,flds) in self.col.db.execute("""
|
||||||
select id, mid, flds from notes
|
select id, mid, flds from notes
|
||||||
|
@ -273,7 +273,9 @@ where mid in %s and flds like ? escape '\\'""" % (
|
||||||
if re.search(regex, strg):
|
if re.search(regex, strg):
|
||||||
nids.append(id)
|
nids.append(id)
|
||||||
extra = "not" if isNeg else ""
|
extra = "not" if isNeg else ""
|
||||||
self.lims['preds'].append("n.id %s in %s" % (extra, ids2str(nids)))
|
self.lims['preds'].append("""
|
||||||
|
n.mid in %s and n.id %s in %s""" % (
|
||||||
|
ids2str(mods.keys()), extra, ids2str(nids)))
|
||||||
|
|
||||||
# Most of this function was written by Marcus
|
# Most of this function was written by Marcus
|
||||||
def _parseQuery(self):
|
def _parseQuery(self):
|
||||||
|
|
Loading…
Reference in a new issue