Port Manticore and debug

This commit is contained in:
2025-01-23 11:35:39 +00:00
parent fe087eb591
commit a4c3834b62
11 changed files with 29 additions and 17 deletions

View File

@@ -253,7 +253,6 @@ class StorageBackend(ABC):
"took": time_took_rounded,
"cache": True,
}
print("S2", search_query)
response = self.run_query(user, search_query, **kwargs)
# For Elasticsearch

View File

@@ -57,7 +57,6 @@ class ManticoreBackend(StorageBackend):
"limit": size,
"query": {"bool": {"must": []}},
}
print("BASE", query_base)
query_string = {
"query_string": query,
}
@@ -77,7 +76,6 @@ class ManticoreBackend(StorageBackend):
raw = kwargs.get("raw")
if search_query and not raw:
search_query["index"] = index
pprint(search_query)
path = kwargs.get("path", "json/search")
@@ -98,7 +96,6 @@ class ManticoreBackend(StorageBackend):
"""
index = kwargs.get("index")
search_query["index"] = index
pprint(search_query)
async with httpx.AsyncClient() as client:
response = await client.post(
f"{settings.MANTICORE_URL}/json/search", json=search_query

View File

@@ -94,7 +94,7 @@ def parse_results(results, meta=None):
del element[field]
# Unfold the tokens
if "tokens" in element:
if element["tokens"].startswith('["'):
if element["tokens"].startswith('["') or element["tokens"].startswith("['"):
tokens_parsed = ast.literal_eval(element["tokens"])
element["tokens"] = tokens_parsed