Fix ZNC queries
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
def construct_query(index, net, channel, src, num, size, nicks=None):
|
||||
def construct_query(index, net, channel, src, num, size, type=None, nicks=None):
|
||||
# Get the initial query
|
||||
extra_must = []
|
||||
extra_should = []
|
||||
@@ -26,8 +26,14 @@ def construct_query(index, net, channel, src, num, size, nicks=None):
|
||||
]
|
||||
if index == "int":
|
||||
fields.append("mtype")
|
||||
for ctype in types:
|
||||
extra_should.append({"match": {"mtype": ctype}})
|
||||
if channel == "*status" or type == "znc":
|
||||
if {"match": {"channel": channel}} in extra_must:
|
||||
extra_must.remove({"match": {"channel": channel}})
|
||||
extra_should2 = []
|
||||
extra_must.append({"match": {"type": "znc"}})
|
||||
else:
|
||||
for ctype in types:
|
||||
extra_should.append({"match": {"mtype": ctype}})
|
||||
else:
|
||||
for ctype in types:
|
||||
extra_should.append({"match": {"type": ctype}})
|
||||
@@ -54,5 +60,4 @@ def construct_query(index, net, channel, src, num, size, nicks=None):
|
||||
"fields": fields,
|
||||
"_source": False,
|
||||
}
|
||||
|
||||
return query
|
||||
|
||||
Reference in New Issue
Block a user