Implement scrollback modal
This commit is contained in:
31
core/lib/context.py
Normal file
31
core/lib/context.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from core.lib.opensearch import client, run_main_query
|
||||
from django.conf import settings
|
||||
|
||||
def construct_query(net, channel, src, num, size):
|
||||
# Get the initial query
|
||||
extra_must = []
|
||||
if num:
|
||||
extra_must.append({"match": {"num": num}})
|
||||
types = ["msg", "notice", "action", "kick", "topic", "mode"]
|
||||
query_should = [{"match": {"type": x}} for x in types]
|
||||
query = {
|
||||
"size": size,
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{"match": {"net": net}},
|
||||
{"match": {"channel": channel}},
|
||||
{"match": {"src": src}},
|
||||
{
|
||||
"bool": {
|
||||
"should": query_should,
|
||||
}
|
||||
},
|
||||
*extra_must
|
||||
]
|
||||
}
|
||||
},
|
||||
"fields": ["nick", "ident", "host", "channel", "ts", "msg", "type", "net", "src"],
|
||||
"_source": False,
|
||||
}
|
||||
return query
|
||||
Reference in New Issue
Block a user