fix: title lookup asks every provider and ranks exact title matches first #94

Merged
jfro merged 2 commits from fix/title-lookup-all-providers into main 2026-10-25 23:01:36 +00:00
Owner

Refs #91 (Nye's F3: "The Hugo Winners - Volumes I & II" misses its exact Hardcover match). Stacked on #86 (feat/title-author-lookup); merge right after it.

Cause: BookLookup title search returned the first provider that answered. config/config.exs orders providers Open Library, Hardcover, Google, LoC, so any Open Library near-miss hid Hardcover's results.

Fix (title and title+author paths only; ISBN/UPC unchanged):

  • Query every configured provider concurrently (Task.async_stream, 8s per provider, on_timeout: :kill_task; overridable via :book_lookup, :title_search_timeout).
  • Skip "Not configured" and errors; log name, result count and ms per provider; timeouts/crashes logged as warning/error.
  • Merge in config order, dedupe by ISBN-13 (else normalized title + author), exact normalized-title matches first (case, accents, punctuation ignored, & = and), then #86's author ranking, capped at 20.
  • Each result carries :provider (its provider's name) for #91's UI.

Tests: Nye's proof book_lookup_hugo_winners_test.exs (fails 0/2 on #86, passes here), new book_lookup_all_providers_test.exs (merge/dedupe/order, Hardcover not configured + failing provider, timeout, cap, normalization). Existing stubs updated to report to the test process via $callers. mix precommit: 653 tests pass.

Refs #91 (Nye's F3: "The Hugo Winners - Volumes I & II" misses its exact Hardcover match). Stacked on #86 (`feat/title-author-lookup`); merge right after it. **Cause:** `BookLookup` title search returned the first provider that answered. `config/config.exs` orders providers Open Library, Hardcover, Google, LoC, so any Open Library near-miss hid Hardcover's results. **Fix (title and title+author paths only; ISBN/UPC unchanged):** - Query every configured provider concurrently (`Task.async_stream`, 8s per provider, `on_timeout: :kill_task`; overridable via `:book_lookup, :title_search_timeout`). - Skip "Not configured" and errors; log name, result count and ms per provider; timeouts/crashes logged as warning/error. - Merge in config order, dedupe by ISBN-13 (else normalized title + author), exact normalized-title matches first (case, accents, punctuation ignored, `&` = `and`), then #86's author ranking, capped at 20. - Each result carries `:provider` (its provider's name) for #91's UI. **Tests:** Nye's proof `book_lookup_hugo_winners_test.exs` (fails 0/2 on #86, passes here), new `book_lookup_all_providers_test.exs` (merge/dedupe/order, Hardcover not configured + failing provider, timeout, cap, normalization). Existing stubs updated to report to the test process via `$callers`. `mix precommit`: 653 tests pass.
jfro added this to the v0.9.0 milestone 2026-10-25 22:00:25 +00:00
fix: title lookup asks every provider and ranks exact title matches first
All checks were successful
CI / test (pull_request) Successful in 1m9s
b6b81e7c6c
Manual title lookup stopped at the first provider that answered, and
config.exs puts Open Library before Hardcover, so Open Library's
near-misses for "The Hugo Winners - Volumes I & II" hid Hardcover's
exact match (Nye's F3).

Both title paths now query every configured provider concurrently
(8s per-provider timeout), merge results in config order, drop
duplicates (ISBN-13, else title+author), put exact normalized-title
matches first (& = and), keep the author ranking on top of that, cap
at 20, and tag each result with its provider. ISBN/UPC lookups are
unchanged.
jfro changed target branch from feat/title-author-lookup to main 2026-10-25 22:15:06 +00:00
jfro force-pushed fix/title-lookup-all-providers from b6b81e7c6c
All checks were successful
CI / test (pull_request) Successful in 1m9s
to 057eac1af5
All checks were successful
CI / test (pull_request) Successful in 48s
2026-10-25 22:16:06 +00:00
Compare
jfro merged commit c1091a5c06 into main 2026-10-25 23:01:36 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfro/fuzzy_catalog!94
No description provided.