Skip to content

Commit

Permalink
fix: add query_logo_id field in /ann/search response
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Dec 23, 2022
1 parent b8f2d04 commit 698025c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions robotoff/app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ def on_get(
)
if not response["hits"]["hits"]:
# We don't have any embedding indexed
resp.media = {"results": [], "count": 0}
resp.media = {"results": [], "count": 0, "query_logo_id": None}
return
logo_id = int(response["hits"]["hits"][0]["_id"])

Expand All @@ -923,7 +923,11 @@ def on_get(
if item[0] != logo_id
][:count]
results = [{"logo_id": item[0], "distance": item[1]} for item in raw_results]
resp.media = {"results": results, "count": len(results)}
resp.media = {
"results": results,
"count": len(results),
"query_logo_id": logo_id,
}


class WebhookProductResource:
Expand Down

0 comments on commit 698025c

Please sign in to comment.