upgrade schema, resolvers, panel added

This commit is contained in:
2025-05-16 09:23:48 +03:00
parent 8a60bec73a
commit 2d382be794
80 changed files with 8641 additions and 1100 deletions

View File

@@ -171,11 +171,16 @@ class SearchService:
}
asyncio.create_task(self.perform_index(shout, index_body))
def close(self):
if self.client:
self.client.close()
async def perform_index(self, shout, index_body):
if self.client:
try:
await asyncio.wait_for(
self.client.index(index=self.index_name, id=str(shout.id), body=index_body), timeout=40.0
self.client.index(index=self.index_name, id=str(shout.id), body=index_body),
timeout=40.0,
)
except asyncio.TimeoutError:
logger.error(f"Indexing timeout for shout {shout.id}")
@@ -188,7 +193,9 @@ class SearchService:
logger.info(f"Ищем: {text} {offset}+{limit}")
search_body = {
"query": {"multi_match": {"query": text, "fields": ["title", "lead", "subtitle", "body", "media"]}}
"query": {
"multi_match": {"query": text, "fields": ["title", "lead", "subtitle", "body", "media"]}
}
}
if self.client: