BNF catalogue general

Metadata
creation year: 2026

About

Rust wrapper around the BnF Catalogue général SRU 2.0 API.

Blocking reqwest client + typed CQL builder covering every bib.* and aut.* criterion from the BnF criteria table (24/01/2019) (See pdf in assets folder).

Install

cargo add bnf_catalogue_general

or

[dependencies]
bnf_catalogue_general = "0.1.0"

Usage

use bnf_catalogue_general::{SruClient, SearchRetrieveRequest, RecordSchema};
use bnf_catalogue_general::cql::{clause, BibIndex, Relation};

let client = SruClient::new()?;

let query = clause(BibIndex::Author, Relation::All, "victor hugo");
// -> (bib.author all "victor hugo")

let req = SearchRetrieveRequest::new(query)
    .record_schema(RecordSchema::UnimarcXchange)
    .maximum_records(10);

let resp = client.search_get(&req)?;

println!("{} hits", resp.number_of_records);
println!("{}", resp.xml); // raw UNIMARC / INTERMARC / Dublin Core XML

Combining clauses

use bnf_catalogue_general::cql::{and, clause, BibIndex, Relation};

let q = and(
    clause(BibIndex::Author, Relation::All, "hugo"),
    clause(BibIndex::PublicationDate, Relation::Eq, "1862"),
);

or and not work the same way. Quote escaping in values is handled by clause.

Authority records

By default the server only returns validated authorities. To include preliminary records, wrap your query:

use bnf_catalogue_general::cql::{clause, with_sparse_authorities, AutIndex, Relation};

let q = with_sparse_authorities(
    clause(AutIndex::AccessPoint, Relation::All, "proust marcel"),
);

POST instead of GET

client.search_post(&req)?;
// or
client.search(HttpMethod::Post, &req)?;