This commit is contained in:
parent
ebf1309b48
commit
c1fe419ff9
|
@ -307,11 +307,13 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0):
|
|||
scores[shout_id] = sr.get("score")
|
||||
hits_ids.append(shout_id)
|
||||
result = local_session().execute(query_shouts()).unique()
|
||||
shouts = []
|
||||
for shout in result:
|
||||
shout.score = scores[f"{shout.id}"]
|
||||
shouts.append(shout)
|
||||
shouts.sort(key=lambda x: x.score, reverse=True)
|
||||
if result:
|
||||
logger.debug(result)
|
||||
shouts = []
|
||||
for shout in result:
|
||||
shout.score = scores[f"{shout.id}"]
|
||||
shouts.append(shout)
|
||||
shouts.sort(key=lambda x: x.score, reverse=True)
|
||||
return shouts
|
||||
return []
|
||||
|
||||
|
|
|
@ -179,10 +179,9 @@ class SearchService:
|
|||
body=search_body,
|
||||
size=limit,
|
||||
from_=offset,
|
||||
_source_includes=["_id", "_score"])
|
||||
_source_excludes=["title", "body", "subtitle", "media", "lead"])
|
||||
hits = search_response["hits"]["hits"]
|
||||
results = [{"id": hit["_id"], "score": hit["_score"]} for hit in hits]
|
||||
# results = [{**hit["_source"], "score": hit["_score"]} for hit in hits]
|
||||
|
||||
# если результаты не пустые
|
||||
if results:
|
||||
|
|
Loading…
Reference in New Issue
Block a user