Update internal index name

This commit is contained in:
Mark Veidemanis 2022-09-05 07:20:30 +01:00
parent 0882d3f0da
commit f35eb51aaf
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
7 changed files with 18 additions and 11 deletions

View File

@ -18,7 +18,7 @@ OPENSEARCH_SOURCES_RESTRICTED = ["irc"]
MANTICORE_URL = "http://monolith-db-1:9308"
MANTICORE_INDEX_MAIN = "main"
MANTICORE_INDEX_META = "meta"
MANTICORE_INDEX_INT = "int"
MANTICORE_INDEX_INT = "internal"
MANTICORE_MAIN_SIZES = ["20", "50", "100", "200", "400", "800"]
MANTICORE_MAIN_SIZES_ANON = ["20", "50", "100"]

View File

@ -25,7 +25,7 @@ def construct_query(index, net, channel, src, num, size, type=None, nicks=None):
"src",
"tokens",
]
if index == "int":
if index == "internal":
fields.append("mtype")
if channel == "*status" or type == "znc":
if {"match": {"channel": channel}} in extra_must:

View File

@ -84,7 +84,12 @@ def run_query(client, user, search_query):
response["cache"] = True
return response
response = client.search(search_query)
print("PRERESP", response)
response = response.to_dict()
print("RESP", response)
if "took" in response:
if response["took"] is None:
return None
filter_blacklisted(user, response)
# Write cache
@ -147,7 +152,7 @@ def query_results(
}
if index == "meta":
index = settings.MANTICORE_INDEX_META
elif index == "int":
elif index == "internal":
index = settings.MANTICORE_INDEX_INT
else:
message = "Index is not valid."
@ -317,7 +322,9 @@ def query_results(
search_query,
)
if not results:
return False
message = "Error running query"
message_class = "danger"
return {"message": message, "class": message_class}
# results = results.to_dict()
results_parsed = parse_results(results)
if annotate:

View File

@ -383,7 +383,7 @@ def query_results(
}
if index == "meta":
index = settings.OPENSEARCH_INDEX_META
elif index == "int":
elif index == "internal":
index = settings.OPENSEARCH_INDEX_INT
else:
message = "Index is not valid."

View File

@ -106,7 +106,7 @@
"channel": "*status",
"time": "None",
"date": "None",
"index": "int",
"index": "internal",
"type": "znc",
"mtype": "None",
"nick": "*status",
@ -196,7 +196,7 @@
"channel": "{{ sinst.entity }}",
"time": "None",
"date": "None",
"index": "int",
"index": "internal",
"type": "auth",
"mtype": "None",
"nick": "{{ sinst.entity }}",

View File

@ -354,10 +354,10 @@
<option value="main">Main</option>
{% endif %}
{% if params.index == 'int' %}
<option selected value="int">Internal</option>
{% if params.index == 'internal' %}
<option selected value="internal">Internal</option>
{% else %}
<option value="int">Internal</option>
<option value="internal">Internal</option>
{% endif %}
{% if params.index == 'meta' %}

View File

@ -338,7 +338,7 @@ class DrilldownContextModal(APIView):
query = True
if (
query_params["index"] == "int"
query_params["index"] == "internal"
and query_params["mtype"] == "msg"
and not type == "query"
):