Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion internal/search/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading