This adds a search filter to GET /api/v2/series/ so clients can find the most likely Series without paging through thousands of alphabetically ordered substring matches. I kept the existing name filter unchanged.
The ranking is deterministic: case-insensitive exact title, title prefix, token prefix, then general substring. Ties use sort_name, year_began, and id, so pagination stays stable. Query whitespace is normalized, punctuation is treated literally, and title matching is accent-sensitive so a title such as Båtman does not rank as an exact Batman match.
I tested this against the current full public dump with 232,238 active Series. Repeating the first 200 Batman results returned the same IDs, page 2 had no overlap, and all 133 exact-title matches came first. Measured endpoint latency was:
| Query | Matches | First request | Warm median |
|---|---|---|---|
Batman |
3,723 | 606.0 ms | 259.9 ms |
Spider-Man |
1,955 | 242.5 ms | 231.3 ms |
X |
13,983 | 213.3 ms | 216.3 ms |
A (stress case) |
177,030 | 333.7 ms | 322.1 ms |
The filter composes with the existing Series filters and is included in the OpenAPI schema. There is no migration or model change.
Validation:
pytest -q apps/api_v2/tests — 329 passedruff check apps/api_v2/ruff format --check apps/api_v2/python manage.py checkpython manage.py makemigrations --check --dry-runpython manage.py migrate --checkhttps://github.com/GrandComicsDatabase/gcd-django/pull/777
(4 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()