From e480f07c32f0ea167fadfc4f8a9118f306694c2c Mon Sep 17 00:00:00 2001 From: funkpower Date: Tue, 22 Sep 2026 09:36:46 -0400 Subject: [PATCH] =?UTF-8?q?0.3.1=20=E2=80=94=20ask=20the=20index=20first,?= =?UTF-8?q?=20which=20answers=20in=20one=20request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The chain asked OpenLibrary's edition record first and its search index second. The edition record is the slow one: measured against this library it takes five to twenty-eight seconds, and it names its authors by key, so a second request was needed anyway. The index, asked for its fields by name, returns the title, the authors, the publisher, the language, a page count and the subjects together, in about a quarter of a second. Reordering them turns three requests per book into one, and a pass over five thousand books from fifty-three hours into well under one. The edition record is still there for a subtitle or a publisher the index did not give. --- crates/bibfetch/src/source.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/bibfetch/src/source.rs b/crates/bibfetch/src/source.rs index ca1ab80..632ca1d 100644 --- a/crates/bibfetch/src/source.rs +++ b/crates/bibfetch/src/source.rs @@ -55,9 +55,17 @@ impl Source { match kind { "doi" => &[Source::Crossref], "arxiv" => &[Source::Arxiv], + // The index first. Asked for the fields by name it answers with + // the title, the authors, the publisher, the language, a page + // count and the subjects in one request, which is the whole of + // what a catalogue wants; the edition record is then needed only + // for a subtitle or a publisher the index did not give. Asking it + // second cost three requests per book where one usually does, and + // at three books in flight that is the difference between two + // days and two hours. "isbn" => &[ - Source::OpenLibrary, Source::OpenLibrarySearch, + Source::OpenLibrary, Source::GoogleBooks, ], _ => &[],