Skip to content

Upstream quirks

This page lists where the HAL API behaves differently from its documentation. The references are the API documentation, the search documentation, and the referential documentation. Where a quirk affects bibliofabric.hal, the behavior of the client is noted.

Envelopes and errors

  • The JSON answer carries only a top-level response object (docs, numFound, start, maxScore); Solr's responseHeader is absent. nextCursorMark sits at the top level of the body when a cursorMark request produced it.
  • A rejected query answers HTTP 200 with {"error": {"msg": "Error. See help : /docs"}}. The unwrapper raises APIError for that body, so a rejected query never reads as zero results.
  • A request to an unknown path answers HTTP 200 with the HTML documentation page. The client only talks to documented paths.
  • rows answers at most 10000 records; a larger value is silently capped, not rejected. The documented default page size is 30.
  • rows=abc is silently ignored and the request answers the default page size. Unknown sort fields and unknown fq field names are also silently ignored.
  • cursorMark requires a sort on the unique key; without sort=docid asc (or another unique-key sort) the route answers the 200 error envelope. docid desc works as well. The client injects docid asc for cursor requests without a sort.
  • nextCursorMark repeats unchanged once the result set is exhausted; the framework cursor iteration stops on that.
  • Offset paging with start works far beyond the documented cursor recommendation (a start of 99999 answers normally). The documentation recommends cursors for deep walks, and the client follows that advice in iterate().
  • The presence syntax doiId_s:["" TO *] works, but fileMain_s does not: fileMain_s:["" TO *] answers 0, and fileMain_s:* answers 0 whenever it is combined with another clause in the same fq. The client therefore offers has_doi but no has_file filter.
  • With no fl parameter the answer carries only docid, label_s, and uri_s. Each resource sends its full field set as fl so that the models validate.
  • Facet answers (facet=true, facet.field=...) come back under a top-level facet_counts key and reach the caller through Page.meta.

Referentials

  • Every /ref/<name> route speaks the same Solr envelope as /search/; the unique key is docid everywhere except ref/instance.
  • /ref/instance carries its own small schema (id, code, name, url, deprecated) and ignores q as well as rows and start: every answer carries the full table (about 200 records) whatever the query says. The client therefore matches get() and exists() against the full table on the client side. count() still reports the total.
  • /ref/doctype does not speak the Solr envelope at all. It answers {"response": {"lst": ..., "result": {"doc": [{"str": [code, label], "arr": {"doc": [...]}}]}}} in one unpaged request; the client parses that shape into Doctype records with their subtypes.
  • /ref/metadata answers HTTP 500 with an empty body; the documented route appears broken. The metadata value table lives at /ref/metadatalist.
  • A referential docid can carry a dash, for example 164005-0 in /ref/author. The client quotes docid queries for that reason.

Fields

  • Solr marks most HAL fields multivalued, so a field that looks scalar in one record (for example parentName_s on structures) arrives as a list in another. The models type the fields that vary as lists.
  • The main deposited file is exposed in the fileMain_s field, not fileMain as older documentation pages say.
  • The versioned record URL (https://hal.science/hal-03923934v1) does not match uri_s lookups; the client drops the v<n> suffix when it normalizes a record URL.

Rate limit

  • The documentation asks clients to stay below 5 to 10 requests per second. The client defaults to 3 requests per second with a concurrency of 2.