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