Let `/bulk-lookup` callers tell "not searched" apart from "no matches"

Đang mở
#298 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
fastapi, python
Lĩnh vực
api, backend-api-design

Hướng nghiên cứu

Start by reading lookup() and the /bulk-lookup endpoint, then compare its response shape with /lookup and the RequestValidationError response. Decide whether to document the behavior or expose per-string diagnostics without failing the batch or breaking existing callers; the issue leaves that API design open. Done means callers can distinguish unsearched strings from searched strings with no matches, while one unsearchable string still does not fail the batch.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

/bulk-lookup returns [] for a string that was rejected without being searched and for a string that was searched and matched nothing. A caller cannot tell the two apart.

There are two ways a string gets an empty list today, both from the length check in lookup():

  • it is empty, or empty once leading/trailing whitespace is stripped;
  • it is shorter than minimum_query_length (default 2, NAMERES_MINIMUM_QUERY_LENGTH) and is not an exact query.

/lookup distinguishes these — it rejects them with an HTTP 422 carrying a RequestValidationError body. /bulk-lookup deliberately does not, because failing the whole batch over one bad string is worse than the missing diagnostic (see #279). But that leaves a caller sending a few thousand strings with no way to find out that some of them were never searched, and the natural conclusion — "NameRes has nothing for this string" — is wrong.

This matters most for the callers /bulk-lookup exists to serve: a named entity recognition pipeline feeding NameRes its extracted spans has no reason to expect that a two-character span is treated differently from a twenty-character one, and will silently record a miss.

Worth deciding:

  • whether to report it at all, or to document the behaviour more loudly and leave it;
  • if reported, where it goes. The response is Dict[str, List[LookupResult]] keyed by the input string, so there is no obvious place for per-string metadata without changing that shape — which would be a breaking change for every existing caller. A sibling key in the response body ({"results": {...}, "not_searched": [...]}), or an opt-in query parameter that switches to the richer shape, both avoid that.

Note that any fix should keep the property that one unsearchable string does not fail the batch; that part is working as intended.

Ngôn ngữ chính
Python
Star
5
Fork
4
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NCATSTranslator/NameResolution

Tất cả issue của NCATSTranslator/NameResolution

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.