diff --git a/resolvers/reader.py b/resolvers/reader.py index d05d18c6..7b0ddb20 100644 --- a/resolvers/reader.py +++ b/resolvers/reader.py @@ -305,12 +305,11 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0): shout_id = int(shout_id) scores[shout_id] = sr.get("score") hits_ids.append(shout_id) - shouts = [] - with local_session() as session: - shouts = session.execute(query_shouts()) - for shout in shouts: - shout.score = scores[int(shout.id)] - return shouts.unique() + shouts = get_shouts_from_query(query_shouts()) + for shout in shouts: + shout.score = scores[int(shout.id)] + shouts.sort(key=lambda x: x.score, reverse=True) + return shouts return [] diff --git a/services/logger.py b/services/logger.py index c133fe05..43efb4b9 100644 --- a/services/logger.py +++ b/services/logger.py @@ -74,7 +74,7 @@ ignore_logs = [ "aiohttp", "_client", "._make_request", - "base._log_request_response" + "base._log_request_response", ] for lgr in ignore_logs: loggr = logging.getLogger(lgr) diff --git a/services/rediscache.py b/services/rediscache.py index 48c2a4e8..356fd886 100644 --- a/services/rediscache.py +++ b/services/rediscache.py @@ -25,7 +25,7 @@ class RedisCache: async def execute(self, command, *args, **kwargs): if self._client: try: - logger.debug(f"{command}") # {args[0]}") # {args} {kwargs}") + logger.debug(f"{command}") # {args[0]}") # {args} {kwargs}") for arg in args: if isinstance(arg, dict): if arg.get("_sa_instance_state"): diff --git a/services/search.py b/services/search.py index 92220616..7d457f0c 100644 --- a/services/search.py +++ b/services/search.py @@ -1,14 +1,13 @@ import asyncio import json -import os import logging +import os from opensearchpy import OpenSearch from services.encoders import CustomJSONEncoder from services.rediscache import redis - # Set redis logging level to suppress DEBUG messages logger = logging.getLogger("search") logger.setLevel(logging.WARNING)