Skip to content

Commit

Permalink
Fix gRPC gateway compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lalinsky committed Feb 21, 2024
1 parent 90d8c61 commit d9c850b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions acoustid/data/fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ def _search_via_fpstore(
logger.info("Matched fingerprint %s", match)
match = match._replace(score=matching_fingerprint_ids[match.fingerprint_id])
matches.append(match)

matches.sort(key=lambda m: -m.score)

return matches

def search(
Expand Down
4 changes: 2 additions & 2 deletions acoustid/fpstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def _parse_search_response(
for result in response.json()["results"]:
results.append(
FpstoreSearchResult(
fingerprint_id=result["id"],
score=result["similarity"],
fingerprint_id=int(result["id"]),
score=float(result["similarity"]),
)
)
logger.info(f"Search results: {results}")
Expand Down

0 comments on commit d9c850b

Please sign in to comment.