mirror of
https://github.com/valitydev/SigmaHQ.git
synced 2024-11-07 09:48:58 +00:00
SingleTextQueryBackend ignores empty components in composed queries
Example: one component of a AND-composition is ignored if invoked generate* call returns None.
This commit is contained in:
parent
d8a7bcad39
commit
e72c0d5de4
@ -381,16 +381,34 @@ class SingleTextQueryBackend(RulenameCommentMixin, BaseBackend, QuoteCharMixin):
|
|||||||
mapListValueExpression = None # Syntax for field/value condititons where map value is a list
|
mapListValueExpression = None # Syntax for field/value condititons where map value is a list
|
||||||
|
|
||||||
def generateANDNode(self, node):
|
def generateANDNode(self, node):
|
||||||
return self.andToken.join([self.generateNode(val) for val in node])
|
generated = [ self.generateNode(val) for val in node ]
|
||||||
|
filtered = [ g for g in generated if g is not None ]
|
||||||
|
if filtered:
|
||||||
|
return self.andToken.join(filtered)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def generateORNode(self, node):
|
def generateORNode(self, node):
|
||||||
return self.orToken.join([self.generateNode(val) for val in node])
|
generated = [ self.generateNode(val) for val in node ]
|
||||||
|
filtered = [ g for g in generated if g is not None ]
|
||||||
|
if filtered:
|
||||||
|
return self.orToken.join(filtered)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def generateNOTNode(self, node):
|
def generateNOTNode(self, node):
|
||||||
return self.notToken + self.generateNode(node.item)
|
generated = self.generateNode(node.item)
|
||||||
|
if generated is not None:
|
||||||
|
return self.notToken + generated
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def generateSubexpressionNode(self, node):
|
def generateSubexpressionNode(self, node):
|
||||||
return self.subExpression % self.generateNode(node.items)
|
generated = self.generateNode(node.items)
|
||||||
|
if generated:
|
||||||
|
return self.subExpression % generated
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
def generateListNode(self, node):
|
def generateListNode(self, node):
|
||||||
if not set([type(value) for value in node]).issubset({str, int}):
|
if not set([type(value) for value in node]).issubset({str, int}):
|
||||||
|
Loading…
Reference in New Issue
Block a user