search-with-images11
All checks were successful
Deploy on push / deploy (push) Successful in 1m8s

This commit is contained in:
Untone 2024-06-02 17:01:22 +03:00
parent 8e77a57bc1
commit 8cc9d0d4d3
4 changed files with 8 additions and 10 deletions

View File

@ -305,12 +305,11 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0):
shout_id = int(shout_id) shout_id = int(shout_id)
scores[shout_id] = sr.get("score") scores[shout_id] = sr.get("score")
hits_ids.append(shout_id) hits_ids.append(shout_id)
shouts = [] shouts = get_shouts_from_query(query_shouts())
with local_session() as session: for shout in shouts:
shouts = session.execute(query_shouts()) shout.score = scores[int(shout.id)]
for shout in shouts: shouts.sort(key=lambda x: x.score, reverse=True)
shout.score = scores[int(shout.id)] return shouts
return shouts.unique()
return [] return []

View File

@ -74,7 +74,7 @@ ignore_logs = [
"aiohttp", "aiohttp",
"_client", "_client",
"._make_request", "._make_request",
"base._log_request_response" "base._log_request_response",
] ]
for lgr in ignore_logs: for lgr in ignore_logs:
loggr = logging.getLogger(lgr) loggr = logging.getLogger(lgr)

View File

@ -25,7 +25,7 @@ class RedisCache:
async def execute(self, command, *args, **kwargs): async def execute(self, command, *args, **kwargs):
if self._client: if self._client:
try: try:
logger.debug(f"{command}") # {args[0]}") # {args} {kwargs}") logger.debug(f"{command}") # {args[0]}") # {args} {kwargs}")
for arg in args: for arg in args:
if isinstance(arg, dict): if isinstance(arg, dict):
if arg.get("_sa_instance_state"): if arg.get("_sa_instance_state"):

View File

@ -1,14 +1,13 @@
import asyncio import asyncio
import json import json
import os
import logging import logging
import os
from opensearchpy import OpenSearch from opensearchpy import OpenSearch
from services.encoders import CustomJSONEncoder from services.encoders import CustomJSONEncoder
from services.rediscache import redis from services.rediscache import redis
# Set redis logging level to suppress DEBUG messages # Set redis logging level to suppress DEBUG messages
logger = logging.getLogger("search") logger = logging.getLogger("search")
logger.setLevel(logging.WARNING) logger.setLevel(logging.WARNING)