saerch-fix
Some checks failed
Deploy on push / deploy (push) Has been cancelled

This commit is contained in:
Untone 2024-06-02 14:10:49 +03:00
parent 9b2db3cc1d
commit 2e5919f3e6

View File

@ -165,7 +165,15 @@ class SearchService:
async def search(self, text, limit, offset): async def search(self, text, limit, offset):
logger.debug(f"Ищем: {text}") logger.debug(f"Ищем: {text}")
search_body = {"query": {"match": {"_all": text}}} search_body = {
"query": {
"multi_match": {
"query": text,
"fields": ["title", "lead", "subtitle", "body"]
}
}
}
if self.client: if self.client:
search_response = self.client.search(index=self.index_name, body=search_body, size=limit, from_=offset) search_response = self.client.search(index=self.index_name, body=search_body, size=limit, from_=offset)
hits = search_response["hits"]["hits"] hits = search_response["hits"]["hits"]