Commit 4031c021 authored by Ad Schellevis's avatar Ad Schellevis

(ids) replace wildcard tag in search rules

parent a52ff529
...@@ -182,11 +182,11 @@ class RuleCache(object): ...@@ -182,11 +182,11 @@ class RuleCache(object):
if fieldname in self._rule_fields: if fieldname in self._rule_fields:
if fieldname != fieldnames.split(',')[0].strip(): if fieldname != fieldnames.split(',')[0].strip():
sql += ' or ' sql += ' or '
if searchcontent.find('%') == -1: if searchcontent.find('*') == -1:
sql += 'cast('+fieldname + " as text) like :"+fieldname+" " sql += 'cast('+fieldname + " as text) like :"+fieldname+" "
else: else:
sql += 'cast('+fieldname + " as text) like '%'|| :"+fieldname+" || '%' " sql += 'cast('+fieldname + " as text) like '%'|| :"+fieldname+" || '%' "
sql_filters[fieldname] = searchcontent.replace('%', '') sql_filters[fieldname] = searchcontent.replace('*', '')
else: else:
# not a valid fieldname, add a tag to make sure our sql statement is valid # not a valid fieldname, add a tag to make sure our sql statement is valid
sql += ' 1 = 1 ' sql += ' 1 = 1 '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment