mcp-libraryofcongress 1.1.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,224 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0
4
+
5
+ - A catalogue row pointing at a collection no longer claims an identifier
6
+ `get_item` can take. A search of the photos catalogue for the words civil war
7
+ photographs returns four rows addressed at `/collections/<slug>/`, and the
8
+ slug read off them sent `get_item` to `/item/civil-war/`, where the Library
9
+ answers that it holds nothing. Reading a collection through `get_item` was
10
+ the other way out and was not taken: a collection is a corpus a curator
11
+ built, with a count of records, a set of formats and a filter that opens it,
12
+ and none of that fits a record's shape of rights, call number, repository and
13
+ served copies. `list_collections` publishes collections, `search_items` takes
14
+ their wording as a filter, and the item route holds a record. Such a row now
15
+ carries `identifier: null` beside the `source_url` that opens it, and the
16
+ answer counts the rows carrying no identifier and says `get_item` has nothing
17
+ to take for them. `list_collections` still names each collection by its slug.
18
+ - `list_collections` says which catalogue can be asked for a collection. Of 250
19
+ collections read, 50 publish only formats the `media_type` enum does not hold
20
+ (`web-archives`, `periodicals`, `video` among them) and 6 publish none, so
21
+ their `collection_filter` was advertised with no value of `media_type` able to
22
+ carry it: asked for the Afghanistan Web Archive, all eight catalogues answer
23
+ with nothing, and the failure reached the caller as "nothing matches your
24
+ query". Each row now carries `searchable_media_types`, read off the formats
25
+ the Library publishes for the collection and covering the Library's several
26
+ spellings of one catalogue, so `video` and `prints-and-photographs` name
27
+ `film-and-videos` and `photos`. A row naming none says so with an empty list,
28
+ a note counts those rows and names the formats behind them, and the new
29
+ `searchable_only` argument leaves them out.
30
+ - `search_items` no longer reports the unfiltered total as the count for the
31
+ query as sent. A search whose filter matched nothing is asked again without
32
+ it, and both the heading and `total` then gave the figure of the wider
33
+ search, 311,225 for `history` in the books catalogue, as the number of records
34
+ matching a search that matched none, with one note saying the rows were
35
+ unfiltered while a second repeated the figure as a plain fact. Every
36
+ sentence carrying the count now names the search it counts, the set-aside note
37
+ states that the search as sent matched none, and `total` says the same in its
38
+ description. The advice that note gives points at where each filter's wording
39
+ is published: a subject and a place on a row, a language written in English,
40
+ and a collection under `collection_filter` in `list_collections`.
41
+ - `search_newspapers` calls an excerpt a `passage` only when the page's
42
+ machine-read text carries a searched word as a word. Locating a term as a run
43
+ of letters found `art` inside _particular_, _impartially_, _parts_ and the
44
+ scanning noise _ARtloulttuat_, and `cat` inside _Cattle_: on `art gallery`,
45
+ four of the eight rows labelled `passage` were about wrinkle cream, harness
46
+ parts and a county fair, and each of them was excluded from the count of page
47
+ openings and handed over as the text around the words that matched. A term is
48
+ now found on a word boundary, in any case and with punctuation allowed to sit
49
+ against either end, which is what machine-read text does to a word. A row
50
+ where no term stands as a word is a `page_opening`, counted as one, and its
51
+ excerpt is the start of the page. Measured again on the same three queries:
52
+ thirty rows, eleven `passage` labels, all eleven carrying the words.
53
+ - `search_items` no longer publishes a day and a month a row does not carry.
54
+ The catalogue files every row under one sortable date and fills what the
55
+ record leaves unsaid, so a photograph whose words say `1860` came back as
56
+ `1860-01-01`: on one measured page, twenty-three rows of twenty-five. `date`
57
+ and `year` on a row are now cut back to the precision the row's own words
58
+ support, read from the record block the row nests and the years the index
59
+ files it under, so a row and the record behind it state the same date.
60
+ - A record naming a date of its own beside a range of other years keeps that
61
+ date. `photographed 1864, [printed between 1880 and 1889]` was reported as
62
+ 1864 being the opening of a span, which denies the year the record states
63
+ outright. The note is now raised only when the record's own words write a
64
+ range out and open it on the year the catalogue files the record under.
65
+ - `search_items` reads a page past the last one for what it is. The catalogue
66
+ answers such a page with a 404, which came back as `not_found` and the words
67
+ "the Library of Congress holds nothing at this address" on a call that
68
+ carries no address and about records that exist. The first page is read for
69
+ how many records match, and the answer says which page was asked for, how
70
+ many records match and across how many pages.
71
+ - `search_items` searches a one-character word written in a script where one
72
+ character is a word. Refusing every query whose words run to a single
73
+ character refused `水`, and claimed as a property of the Library something the
74
+ catalogue disproves: on the books catalogue `山水` matches 57 records and
75
+ `水 山水` matches one, so the index does act on the character. Han, Japanese
76
+ and Korean script are searched as they stand, and what the catalogue answers
77
+ for them, including an answer of none, is reported as the answer it is. The
78
+ refusal that remains is for a query whose every word is a single letter.
79
+ - `get_item` no longer publishes a day and a month the record does not carry.
80
+ The catalogue files every record under one sortable date and fills what the
81
+ record leaves unsaid: `mss412100053`, titled twice over as undated, is filed
82
+ at `1848-01-01`, which is the opening of the span its series covers, and a
83
+ record whose own words say `1925.` is filed at `1925-01-01`. `date` is now cut
84
+ back to the precision the record's own words support, `year` reads that value,
85
+ and the new `date_stated` carries those words. A record filed at the opening
86
+ of a span of years says so in a note. A record whose words name a month or a
87
+ day keeps the date as filed, and so does a record that says nothing about its
88
+ date, since it offers nothing to read the filed value against.
89
+ - `search_items` refuses a query whose every word is a single letter.
90
+ The catalogue index holds no word of a single letter: on the books
91
+ catalogue `a`, `b` and `a b` each match nothing, `zz` matches 35,895, and
92
+ `a of` returns exactly the 748,064 that `of` returns alone. Answering with a
93
+ total of zero and "nothing in the books catalogue matches" reported a property
94
+ of the index as a fact about the collection. The refusal is `invalid_input`
95
+ and names the reason.
96
+ - The note on newspaper matches whose excerpt is the opening of the page says
97
+ where the `[page opening]` mark is written. The mark rides on each excerpt in
98
+ the text block; the excerpts in the structured answer hold the machine-read
99
+ text as it stands, with nothing added to them, and the note names
100
+ `excerpt_kind` as what carries the distinction there.
101
+
102
+ - `list_collections` says where paging through the corpus stops. The Library
103
+ publishes 583 collections and divides them into twelve pages of fifty; on the
104
+ twelfth the answer still read "583 collections exist and 33 are shown. Ask for
105
+ page 13 to continue", and page 13 came back as `not_found` with the words the
106
+ Library uses for an address it holds nothing at. The next page is now offered
107
+ only where the Library has one, the last page says it is the last and how many
108
+ pages the corpus runs to at the size asked for, and a page past the last is
109
+ answered as an empty page of a corpus that exists. `page` stops at 100, which
110
+ at a small `limit` stops short of the corpus: at a `limit` of 5 the answer now
111
+ says that 500 of the 583 collections are within reach and that raising `limit`
112
+ brings the rest.
113
+ - `search_items` states an identifier a row does not carry. Searching the
114
+ manuscripts catalogue for abraham lincoln papers returns the Abraham Lincoln
115
+ Papers collection, whose `identifier` is null, and the text block printed that
116
+ row with nothing where the others carry `id:`, which reads as an identifier
117
+ that went unprinted rather than one that does not exist. Such a line now
118
+ states the absence, and the tool description says an identifier comes with a
119
+ row that names a record instead of promising one on every row.
120
+ - A row that is a collection says so. On the same search, one row of the five is
121
+ the corpus a curator built and named rather than a manuscripts record, its
122
+ format reads `collection`, and the catalogue's count of 24,836 counts it in.
123
+ Rows now carry `is_collection`, and where any are present a note counts them,
124
+ says the item route holds nothing at their address, and says that the count
125
+ beside the rows counts them in.
126
+ - A cataloguing code is no longer published as a date. The Library files a
127
+ record whose digits it has not established under a code standing in for them,
128
+ so `uuuu` means an unknown year and `18??` a year known only to its century:
129
+ `2002556854`, Gen. Lafayette's grand march, came back as `(18??)` in the slot
130
+ every other row fills with a year. `date` and `year` are null for such a
131
+ record, the new `date_code` carries the code under a name saying what it is, a
132
+ note says the Library has established no date, and `date_stated` still repeats
133
+ the record's own words, here `Philadelphia : Geo. Willig, [18--]`.
134
+ - A filed date is kept whole only where the record's own words name the month it
135
+ is filed under. Asking whether those words named any month at all kept
136
+ `1934-01-01` on `2004663673`, a Van Vechten self-portrait the record dates
137
+ `1934 May 8.`, and kept `1483-01-01` on an incunable printed `1483-02-17`. The
138
+ month the catalogue filed the record under is now read against the months the
139
+ words name, and the value is cut back to the year when they do not name it. A
140
+ month word counts only where a day or a year stands beside it, so `may` in a
141
+ sentence and `march` in a title name no month, and a year with two digits
142
+ after a hyphen names a month only when the year is the one the record is filed
143
+ under, so `1908-09` beside a record filed at 1908 is 1908 to 1909.
144
+ - `search_newspapers` searches a query of one character. The two searches
145
+ refused a short query in two unrelated shapes: `search_items` in its own words
146
+ with a reason and a hint, `search_newspapers` in the validation framework's,
147
+ as "Too small: expected string to have >=2 characters". The full-text index of
148
+ the newspaper corpus does hold single characters and answers each with a set
149
+ of its own: `a` matches 23,522,867 pages, `x` 13,323,103 and `q` 7,885,360, so
150
+ the minimum refused a question the corpus answers. It is gone. The catalogue
151
+ index holds no such word, `a` and `x` each matching none of the 798,435 books,
152
+ and `search_items` keeps its refusal in its own words.
153
+ - What double quotes do to a newspaper search is stated as measured rather than
154
+ as a rule. The tools, the server instructions and the README all said quoting
155
+ narrows the search sharply and that dropping the quotes finds far more again.
156
+ Measured on ten queries, the count moves by no fixed amount and not always in
157
+ the same direction: `"iron horse"` matches 31,783 pages against 3,393,506
158
+ unquoted and `"good morning"` 129,769 against 12,219,078, while `"new york"`
159
+ matches 14,464,911 against 15,353,114, and `"of the"` matches 20,624,639
160
+ against 5,419,814 for the same words unquoted. What the quotes govern is how
161
+ the Library matches: a page can come back carrying the words apart or in
162
+ another order rather than the phrase as written. That is what is now said,
163
+ with the count named as no measure of the phrase and both forms worth asking.
164
+ - `get_item` refuses an identifier carrying a control character. Such an
165
+ identifier was percent-encoded into the address and sent, and the Library
166
+ answered for something nobody publishes: `2017\u0001645459` came back as a
167
+ timeout and an escape sequence before the same digits as HTTP 500, where an
168
+ identifier climbing out of the item route was already refused as
169
+ `invalid_input` with its reason. Both are malformed identifiers and both are
170
+ now refused before an address is built. The refusal for a control character
171
+ names no identifier: those characters are the ones a terminal, a log and a
172
+ chat window do not draw, so printing the value back would show a different
173
+ spelling from the one that was sent.
174
+ - Counts agree with the numbers they carry. A single match reported `On 1 of 2
175
+ match(es)`, `1 match(es) came back`, `1 row(s) shown carry no date`, `431
176
+ records match and 1 are shown` and `583 collections exist and 1 are shown`.
177
+ The parenthesised plural is gone and the nouns and verbs beside a count now
178
+ take the form that count takes, across the four tools.
179
+ - `get_item` no longer returns the same words twice. The Library assembles the
180
+ description of some records by running the notes it holds on them together, so
181
+ `03027877` returned `First appeared in Tait's magazine, 1847-1849.` as its
182
+ whole description and again as `notes_on_record[0]`, and `2021617173` returned
183
+ its five notes both ways. A note whose words the description already carries
184
+ is left to the description, where it is published whole and paginates, and the
185
+ field says so in its own description.
186
+
187
+ ## 2.0.0
188
+
189
+ ### Breaking change
190
+
191
+ `search_newspapers` no longer returns `words_located`. Each match now carries
192
+ `excerpt_kind`, one of `"passage"` or `"page_opening"`. A caller reading
193
+ `words_located === true` reads `excerpt_kind === "passage"`, and the false case
194
+ reads `"page_opening"`.
195
+
196
+ The boolean and the excerpt disagreed about what they were. `words_located:
197
+ false` means the machine-read text the Library returned stops before the
198
+ searched words, so the excerpt beside it is the **opening of the page** and does
199
+ not carry the match. It sat in the answer in the same place and the same shape
200
+ as a real passage, and a note beside it was the only thing saying otherwise.
201
+ Measured on a live search, four matches in five were openings. Naming the kind
202
+ of thing an excerpt is puts that where it cannot be skipped.
203
+
204
+ ### Also in this release
205
+
206
+ - Every excerpt is now labelled in the rendered text itself, as
207
+ `[passage]` or `[page opening]` ahead of the words, so the mark travels with
208
+ the text a reader copies.
209
+ - The tool described quoting as matching a phrase whole. It does not. Measured:
210
+ `"hell is other people"` quoted returns 18 pages, unquoted 1,634,731, and
211
+ among the quoted results are pages from 1891, 1897 and 1906, which precede the
212
+ line by half a century. Quoting narrows hard and decides nothing about how the
213
+ Library matches. The promise is gone from the tool description and from both
214
+ halves of the README, and a quoted query now carries a note saying the match
215
+ is not guaranteed to be the phrase.
216
+ - Headings said the pages carry the query. They say what the Library matched.
217
+
218
+ `NewspaperHit.wordsLocated`, on the `./client` subpath, is unchanged: it is the
219
+ raw fact about the text received, and the tool layer names the kind of thing it
220
+ renders from it.
221
+
3
222
  ## 1.1.0
4
223
 
5
224
  - An argument no tool declared was read and dropped, and the answer came back
package/README.md CHANGED
@@ -55,7 +55,7 @@ npm and no configuration file to edit.
55
55
  | `search_newspapers` | Finds a phrase in the text of scanned newspaper pages. | `query`, `location`, `publication`, `year_from`, `limit` |
56
56
  | `search_items` | Searches one catalogue: books, photos, maps, audio, more. | `query`, `media_type`, `subject`, `location`, `year_from` |
57
57
  | `get_item` | Reads one record, section by section. | `identifier`, `sections`, `offset` |
58
- | `list_collections` | The digital collections, with the filter each one takes. | `limit`, `page`, `max_description_chars` |
58
+ | `list_collections` | The digital collections, with the filter each one takes. | `limit`, `page`, `searchable_only` |
59
59
 
60
60
  The server is **read-only**. It uploads nothing and writes nothing back.
61
61
 
@@ -64,12 +64,19 @@ The server is **read-only**. It uploads nothing and writes nothing back.
64
64
  A catalogue search reads titles, creators and descriptions. `search_newspapers`
65
65
  reads what optical character recognition took off millions of scanned pages of
66
66
  American newspapers, so it answers a question nothing else here can: _which
67
- issue printed this phrase_. A match comes back with the paper, the date, the
67
+ issue printed these words_. A match comes back with the paper, the date, the
68
68
  leaf of the issue, the state it was published in, and an address that opens that
69
69
  leaf with the query applied.
70
70
 
71
- Put a phrase in double quotes to match it whole. Without quotes the words are
72
- matched separately, which finds far more.
71
+ Double quotes change what the search matches, and the Library decides what they
72
+ mean: a matched page can carry the words apart or in another order rather than
73
+ the phrase as written, so an answer to a quoted query says so and points at the
74
+ page to read. What the quotes do to the number of matching pages is the
75
+ Library's own business and varies from one query to the next: measured against
76
+ the corpus, quoting divides the count by a hundred on some queries, moves it by
77
+ a few per cent on others, and raises it above the unquoted count on others
78
+ again. The count is therefore no evidence that the phrase was printed anywhere,
79
+ and both forms are worth asking.
73
80
 
74
81
  The corpus spans every state and a century and a half, so a bare phrase reaches
75
82
  a great deal that a question did not ask for. Three arguments narrow it:
@@ -101,9 +108,14 @@ page 2, 3 and so on rather than treating the first answer as the whole of it.
101
108
 
102
109
  **An excerpt is sometimes the opening of the page.** The Library returns the
103
110
  beginning of a page's text with each row rather than the whole page, so the
104
- searched words are often further down than that text reaches. `words_located`
105
- says which of the two happened: true and the passage is centred on the words,
106
- false and it is the opening of the leaf. Follow `source_url` for the rest.
111
+ searched words are often further down than that text reaches. Every match
112
+ carries `excerpt_kind`, and every excerpt is labelled with it in the text block:
113
+
114
+ - **`passage`**, the text around the words that matched, centred on them.
115
+ - **`page_opening`**, the start of the leaf, sent because the text that came
116
+ back stops before the searched words appear. It does not carry the match, so
117
+ quoting it quotes something else. The notes count how many there are, and
118
+ `source_url` opens the leaf with the query applied.
107
119
 
108
120
  **Scanned text is machine-read.** Excerpts carry the misreadings that come with
109
121
  it. Quote them as scanned text and link the page.
@@ -120,11 +132,24 @@ Narrowing is typed rather than free text: `year_from`, `year_to`, `subject`,
120
132
  matches nothing is set aside, the search is asked again without it, and the
121
133
  answer names what was dropped, so a narrowing that spelled a subject the Library
122
134
  words differently is reported as a spelling that found nothing rather than as
123
- the Library holding nothing on it.
135
+ the Library holding nothing on it. Every sentence carrying the count then names
136
+ the search without the filter, since that is the search the rows and the count
137
+ come from.
124
138
 
125
139
  By default only material with a digitised copy comes back. `online_only: false`
126
140
  takes in the records the Library holds on a shelf alone.
127
141
 
142
+ **The catalogue index holds no word of a single letter.** A query made only of
143
+ such words matches nothing whatever the Library holds, and the same query with
144
+ one longer word beside them returns exactly what that longer word returns alone.
145
+ `search_items` refuses it as invalid input and names the reason, since a count
146
+ of zero would read as a statement about the collection. A word written as one
147
+ character, as Han, Japanese and Korean script write many, is a word the index
148
+ does hold, and it is searched as it stands. The full-text index behind
149
+ `search_newspapers` is a different index and does hold single characters,
150
+ answering each with a set of its own, so `search_newspapers` searches for one
151
+ rather than refusing it.
152
+
128
153
  ## Reading a record, and finding a corpus
129
154
 
130
155
  `get_item` takes one identifier. An identifier can carry slashes: a single
@@ -135,10 +160,61 @@ full field list are each larger than the record they describe. A long
135
160
  description paginates by character offset and resumes at a line boundary: when
136
161
  `next_offset` is not null, call again with `offset` set to it.
137
162
 
163
+ **A malformed identifier is refused rather than answered.** An identifier that
164
+ climbs out of the item route, or one carrying a control character, is
165
+ `invalid_input` before any address is built. The refusal for a control character
166
+ names no identifier: those characters are the ones a terminal, a log and a chat
167
+ window do not draw, so printing the value back would show a different spelling
168
+ from the one that was sent.
169
+
170
+ **The same words are not returned twice.** The Library assembles the description
171
+ of some records by running the notes it holds on them together. A note whose
172
+ words the description already carries is left to the description, so
173
+ `notes_on_record` holds what the description does not.
174
+
175
+ **A row says whether it is a record or a collection.** A catalogue search
176
+ returns, beside its records, the corpora a curator gathered and named, and the
177
+ Library's count of what matches counts them in. Such a row carries
178
+ `is_collection: true`, its `identifier` is null because the item route holds
179
+ nothing at a collection's address, and `source_url` opens the collection. A row
180
+ carrying no identifier says so where the others print theirs, and the notes
181
+ count both kinds.
182
+
183
+ **A cataloguing code is not a date.** Where the Library has established no date
184
+ it files a record under a code standing in for the digits, `uuuu` for an unknown
185
+ year and `18??` for a year known only to its century. `date` and `year` are null
186
+ for such a record, `date_code` carries the code under a name saying what it is,
187
+ and the notes say no date has been established.
188
+
189
+ **A date carries only the precision the record supports.** The catalogue files
190
+ every record under one sortable date and fills what the record leaves unsaid: a
191
+ record whose own words say `1925` is filed at `1925-01-01`, and a piece of a
192
+ series is filed at the opening of the span the series covers. `date` is cut back
193
+ to the precision those words support, in a catalogue row as in a record read on
194
+ its own: the filed value is kept whole only where the words name the month it is
195
+ filed under, so a photograph the record dates `1934 May 8.` and the catalogue
196
+ files at `1934-01-01` comes back as `1934`. A month word counts only where a day
197
+ or a year stands beside it, and a year with two digits after a hyphen names a
198
+ month only when that year is the one the record is filed under, so `1908-09`
199
+ beside a record filed at 1908 reads as 1908 to 1909. `date_stated` repeats the
200
+ words themselves, and a record whose words
201
+ write out a span of years and open it on the filed year carries a note saying
202
+ that `date` and `year` are where the catalogue sorts it. A year the words state
203
+ outright is a date of the record, whatever ranges sit beside it.
204
+
138
205
  `list_collections` shows the bodies of material a curator chose, described and
139
206
  published together, so a caller can see what is there before searching. Each row
140
- carries `collection_filter`, which is the wording `search_items` takes as its
141
- `collection` argument.
207
+ carries `collection_filter`, the wording `search_items` takes as its
208
+ `collection` argument, beside `searchable_media_types`, the catalogues that
209
+ filter can be sent to. The Library gathers kinds of thing the catalogue search
210
+ is not divided into, web archives and periodicals among them: such a collection
211
+ names no `media_type`, says so with an empty list, and `searchable_only` leaves
212
+ those rows out. The corpus runs to hundreds of collections and pages: the answer
213
+ offers the next page only where the Library has one, says when the last has been
214
+ reached and how many pages the corpus runs to at the size asked for, and reads a
215
+ page past the last as an empty page of a corpus that exists. `page` stops at
216
+ 100, so at a small `limit` the answer says how many collections that ceiling
217
+ reaches and that raising `limit` brings the rest within reach.
142
218
 
143
219
  ## What the answers claim
144
220
 
@@ -329,7 +405,7 @@ configuration à modifier.
329
405
  | `search_newspapers` | Trouve une phrase dans le texte des pages de journaux numérisées. | `query`, `location`, `publication`, `year_from`, `limit` |
330
406
  | `search_items` | Cherche un catalogue : livres, photos, cartes, sons, et le reste. | `query`, `media_type`, `subject`, `location`, `year_from` |
331
407
  | `get_item` | Lit une fiche, section par section. | `identifier`, `sections`, `offset` |
332
- | `list_collections` | Les collections numériques, avec le filtre que chacune accepte. | `limit`, `page`, `max_description_chars` |
408
+ | `list_collections` | Les collections numériques, avec le filtre que chacune accepte. | `limit`, `page`, `searchable_only` |
333
409
 
334
410
  Le serveur est **en lecture seule**. Il ne téléverse rien et n'écrit rien.
335
411
 
@@ -338,13 +414,21 @@ Le serveur est **en lecture seule**. Il ne téléverse rien et n'écrit rien.
338
414
  Une recherche de catalogue lit les titres, les auteurs et les descriptions.
339
415
  `search_newspapers` lit ce que la reconnaissance de caractères a tiré de
340
416
  millions de pages de journaux américains numérisées, et répond donc à une
341
- question qu'aucun autre outil ici ne sait traiter : _quel numéro a imprimé cette
342
- phrase_. Une correspondance revient avec le journal, la date, le feuillet du
417
+ question qu'aucun autre outil ici ne sait traiter : _quel numéro a imprimé ces
418
+ mots_. Une correspondance revient avec le journal, la date, le feuillet du
343
419
  numéro, l'État de publication, et une adresse qui ouvre ce feuillet avec la
344
420
  requête appliquée.
345
421
 
346
- Mettez une phrase entre guillemets doubles pour la faire correspondre en entier.
347
- Sans guillemets, les mots sont cherchés séparément, ce qui trouve bien plus.
422
+ Les guillemets doubles changent ce que la recherche retient, et c'est la Library
423
+ qui décide de ce qu'ils veulent dire : une page retenue peut porter les mots
424
+ éloignés les uns des autres ou dans un autre ordre plutôt que la phrase telle
425
+ qu'elle est écrite. La réponse à une requête entre guillemets le dit et renvoie
426
+ à la page à lire. Ce que les guillemets font au nombre de pages retenues
427
+ appartient à la Library et varie d'une requête à l'autre : mesuré sur le corpus,
428
+ le compte est divisé par cent sur certaines requêtes, bouge de quelques pour
429
+ cent sur d'autres, et dépasse le compte sans guillemets sur d'autres encore. Ce
430
+ compte ne prouve donc pas que la phrase ait été imprimée quelque part, et les
431
+ deux formes valent d'être posées.
348
432
 
349
433
  Le corpus couvre tous les États et un siècle et demi : une phrase seule ramène
350
434
  donc beaucoup de choses que la question ne demandait pas. Trois arguments la
@@ -379,9 +463,15 @@ que de prendre la première réponse pour la totalité.
379
463
  **Un extrait est parfois le début de la page.** La Library renvoie le début du
380
464
  texte d'une page avec chaque ligne de résultat plutôt que la page entière, si
381
465
  bien que les mots cherchés se trouvent souvent plus bas que ce texte ne va.
382
- `words_located` indique lequel des deux cas s'est produit : vrai et le passage
383
- est centré sur les mots, faux et c'est le début du feuillet. Suivez `source_url`
384
- pour la suite.
466
+ Chaque correspondance porte `excerpt_kind`, et chaque extrait en porte
467
+ l'étiquette dans le bloc de texte :
468
+
469
+ - **`passage`** : le texte autour des mots correspondants, centré sur eux.
470
+ - **`page_opening`** : le début du feuillet, renvoyé parce que le texte reçu
471
+ s'arrête avant que les mots cherchés n'apparaissent. Il ne porte pas la
472
+ correspondance, donc le citer revient à citer autre chose. Les notes comptent
473
+ combien il y en a, et `source_url` ouvre le feuillet avec la requête
474
+ appliquée.
385
475
 
386
476
  **Le texte numérisé est lu par une machine.** Les extraits en portent les
387
477
  fautes. Citez-les comme tels et suivez le lien.
@@ -397,11 +487,25 @@ Le filtrage est typé plutôt que textuel : `year_from`, `year_to`, `subject`,
397
487
  `location`, `language`, `collection`, `online_only`, `sort`. Un filtre qui ne
398
488
  correspond à rien est mis de côté, la recherche est relancée sans lui, et la
399
489
  réponse nomme ce qui a été écarté : une orthographe différente de celle de la
400
- Library est ainsi signalée comme telle, et non comme un fonds vide.
490
+ Library est ainsi signalée comme telle, et non comme un fonds vide. Chaque
491
+ phrase qui porte le total nomme alors la recherche sans le filtre, puisque c'est
492
+ d'elle que viennent les lignes et le compte.
401
493
 
402
494
  Par défaut, seuls les documents disposant d'une copie numérisée reviennent.
403
495
  `online_only: false` inclut les fiches que la Library ne conserve qu'en rayon.
404
496
 
497
+ **L'index du catalogue ne retient aucun mot d'une seule lettre.** Une requête
498
+ composée uniquement de tels mots ne correspond à rien, quoi que la Library
499
+ détienne, et la même requête accompagnée d'un mot plus long rend exactement ce
500
+ que ce mot rend seul. `search_items` la refuse en `invalid_input` en donnant la
501
+ raison, car un total de zéro se lirait comme une affirmation sur le fonds. Un
502
+ mot qui s'écrit d'un seul caractère, comme les écritures han, japonaise et
503
+ coréenne en comptent beaucoup, est un mot que l'index retient : il est cherché
504
+ tel quel. L'index plein texte derrière `search_newspapers` est un autre index,
505
+ qui retient bel et bien les caractères isolés et répond à chacun par un ensemble
506
+ qui lui est propre : `search_newspapers` cherche un tel caractère au lieu de le
507
+ refuser.
508
+
405
509
  ## Lire une fiche, et trouver un corpus
406
510
 
407
511
  `get_item` prend un identifiant. Un identifiant peut contenir des barres
@@ -413,10 +517,63 @@ qu'elles décrivent. Une description longue se pagine par décalage de caractèr
413
517
  et reprend à une fin de ligne : quand `next_offset` n'est pas nul, rappelez
414
518
  l'outil avec `offset` réglé sur cette valeur.
415
519
 
520
+ **Un identifiant mal formé est refusé, pas répondu.** Un identifiant qui sort de
521
+ la route des fiches, ou qui porte un caractère de contrôle, est `invalid_input`
522
+ avant qu'aucune adresse ne soit construite. Le refus lié à un caractère de
523
+ contrôle ne cite aucun identifiant : ces caractères sont ceux qu'un terminal, un
524
+ journal ou une fenêtre de discussion ne dessinent pas, et le réimprimer
525
+ montrerait une graphie différente de celle qui a été envoyée.
526
+
527
+ **Les mêmes mots ne sont pas rendus deux fois.** La Library compose la
528
+ description de certaines fiches en mettant bout à bout les notes qu'elle tient
529
+ sur elles. Une note dont la description porte déjà les mots est laissée à la
530
+ description : `notes_on_record` tient ce que la description ne porte pas.
531
+
532
+ **Une ligne dit si elle est une fiche ou une collection.** Une recherche
533
+ catalogue rend, à côté de ses fiches, les corpus qu'un conservateur a réunis et
534
+ nommés, et le compte que la Library publie les inclut. Une telle ligne porte
535
+ `is_collection: true`, son `identifier` est null parce que la route des fiches
536
+ ne détient rien à l'adresse d'une collection, et `source_url` l'ouvre. Une ligne
537
+ sans identifiant l'énonce là où les autres impriment le leur, et les notes
538
+ comptent les deux cas.
539
+
540
+ **Un code de catalogage n'est pas une date.** Là où la Library n'a établi
541
+ aucune date, elle range la fiche sous un code qui tient lieu de chiffres :
542
+ `uuuu` pour une année inconnue, `18??` pour une année connue au siècle près.
543
+ `date` et `year` sont null pour une telle fiche, `date_code` porte le code sous
544
+ un nom qui dit ce qu'il est, et les notes disent qu'aucune date n'est établie.
545
+
546
+ **Une date ne porte que la précision que la fiche soutient.** Le catalogue range
547
+ chaque fiche sous une date unique et comble ce que la fiche laisse de côté : une
548
+ fiche dont les mots disent `1925` est rangée au `1925-01-01`, et une pièce d'un
549
+ fonds est rangée à l'ouverture de la période que ce fonds couvre. `date` est
550
+ ramenée à la précision que ces mots soutiennent, dans une ligne de résultat
551
+ comme dans une fiche lue seule : la valeur de rangement n'est gardée entière que
552
+ si les mots nomment le mois sous lequel la fiche est rangée, si bien qu'une
553
+ photographie que la fiche date du `1934 May 8.` et que le catalogue range au
554
+ `1934-01-01` revient en `1934`. Un nom de mois ne compte que si un jour ou une
555
+ année l'accompagne, et une année suivie de deux chiffres après un tiret ne nomme
556
+ un mois que si cette année est celle du rangement : `1908-09` à côté d'une fiche
557
+ rangée en 1908 se lit 1908 à 1909. `date_stated` reprend les mots eux-mêmes, et une
558
+ fiche dont les mots écrivent une période et l'ouvrent sur l'année de rangement
559
+ porte une note disant que `date` et `year` sont l'endroit où le catalogue la
560
+ classe. Une année que les mots énoncent en toutes lettres est une date de la
561
+ fiche, quelles que soient les fourchettes qui l'accompagnent.
562
+
416
563
  `list_collections` montre les ensembles qu'un conservateur a choisis, décrits et
417
564
  publiés ensemble, pour voir ce qui existe avant de chercher. Chaque ligne porte
418
565
  `collection_filter`, la formulation exacte que `search_items` accepte dans son
419
- argument `collection`.
566
+ argument `collection`, et `searchable_media_types`, les catalogues auxquels ce
567
+ filtre peut être adressé. La Library réunit des types de documents que la
568
+ recherche catalogue ne découpe pas, les archives du web et les périodiques parmi
569
+ eux : une telle collection ne nomme aucun `media_type`, le dit par une liste
570
+ vide, et `searchable_only` écarte ces lignes. Le corpus compte plusieurs
571
+ centaines de collections et se pagine : la réponse ne propose la page suivante
572
+ que là où la Library en a une, dit quand la dernière est atteinte et sur combien
573
+ de pages le corpus court à la taille demandée, et lit une page au-delà de la
574
+ dernière comme une page vide d'un corpus qui existe. `page` s'arrête à 100 :
575
+ à faible `limit`, la réponse dit combien de collections ce plafond atteint et
576
+ que relever `limit` met le reste à portée.
420
577
 
421
578
  ## Ce que les réponses affirment
422
579