From eae91193c84a3c400cc0e87d15a165e1930892a1 Mon Sep 17 00:00:00 2001 From: David Santamaria Date: Sun, 31 May 2026 11:19:59 +0200 Subject: [PATCH] fix: use Open Library general `q` search so translated titles match MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Books search used `title=`, which only matches a work's primary (usually English) title — so "Policán 3" (the Spanish title of Dog Man) returned nothing. Switch to the general `q=` parameter, which matches across all fields incl. edition/translated titles and still ranks title hits first. Verified identical quality for dune / harry potter and now finds Dog Man for "Policán". Co-Authored-By: Claude Opus 4.8 (1M context) --- internal/search/service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/search/service.go b/internal/search/service.go index 36e7247..1eaaa4b 100644 --- a/internal/search/service.go +++ b/internal/search/service.go @@ -63,7 +63,10 @@ func getJSON(reqURL string, out interface{}) error { // --- Books: Open Library (keyless) --- func (serv *Service) searchBooks(query string) []Result { - reqURL := "https://openlibrary.org/search.json?limit=5&fields=title,author_name,cover_i,key,first_publish_year&title=" + url.QueryEscape(query) + // Use the general `q` search rather than `title`: it matches across all + // fields including translated/edition titles (e.g. "Policán" -> Dog Man), + // whereas `title` only matches a work's primary (usually English) title. + reqURL := "https://openlibrary.org/search.json?limit=5&fields=title,author_name,cover_i,key,first_publish_year&q=" + url.QueryEscape(query) var payload struct { Docs []struct {