This commit is contained in:
Mark Veidemanis 2022-09-07 07:20:30 +01:00
parent 4bc97dcc4d
commit 816ed2665b
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 4 additions and 3 deletions

View File

@ -7,6 +7,7 @@ from math import floor, log10
from pprint import pprint from pprint import pprint
import manticoresearch import manticoresearch
import requests
import ujson import ujson
from django.conf import settings from django.conf import settings
from siphashc import siphash from siphashc import siphash
@ -14,7 +15,7 @@ from siphashc import siphash
from core import r from core import r
from core.lib.processing import annotate_results, filter_blacklisted, parse_results from core.lib.processing import annotate_results, filter_blacklisted, parse_results
from core.views import helpers from core.views import helpers
import requests
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -83,12 +84,12 @@ def run_query(client, user, search_query):
response["took"] = time_took_rounded response["took"] = time_took_rounded
response["cache"] = True response["cache"] = True
return response return response
#response = client.search(search_query) # response = client.search(search_query)
response = requests.post(f"{settings.MANTICORE_URL}/json/search", json=search_query) response = requests.post(f"{settings.MANTICORE_URL}/json/search", json=search_query)
response = ujson.loads(response.text) response = ujson.loads(response.text)
if "error" in response and len(response.keys()) == 1: if "error" in response and len(response.keys()) == 1:
return response return response
#response = response.to_dict() # response = response.to_dict()
print("RESP", response) print("RESP", response)
if "took" in response: if "took" in response:
if response["took"] is None: if response["took"] is None: