Skip to content

Commit d9ad283

Browse files
bpfoleycpeel
authored andcommitted
external_catalog_search.php: Remove attrs unsupported by z3950.loc.gov
The bib 1 attribute 1004 (Author-name-personal), and bib 1 attribute 6 (Title Uniform) cause errors in queries to z3950.loc.gov, so remove them to avoid confusing project managers. This seems to be one underlying issue behind DP#2114 we can easily fix.
1 parent c0a0b76 commit d9ad283

1 file changed

Lines changed: 19 additions & 45 deletions

File tree

tools/project_manager/external_catalog_search.php

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,15 @@
99
include_once($relPath.'MARCRecord.inc');
1010
include_once($relPath.'pg.inc');
1111

12-
$title_attrs = [
13-
// Bib-1 Use, Title (attribute 4)
14-
// "A word, phrase, character, or group of characters, normally appearing in an item,
15-
// that names the item or the work contained in it.
16-
// Matches 130, 21X-24X, 440, 490, 730, 740, 830, 840, subfield $t in 400, 410, 410, 600,
17-
// 610, 611, 700, 710, 711, 800, 810, 811"
18-
// That leads to broad matches, similar to the KTIL LoC advanced search, but
19-
// sometimes is necessary due to missing fields in MARC records.
20-
// https://catalog.loc.gov/vwebv/ui/en_US/htdocs/help/searchExamples.html#KTIL
21-
22-
4 => _("Title (wide)"),
23-
// Bib-1 Use, Title Uniform (attribute 6)
24-
// "The particular title by which a work is to be identified for cataloging purposes.
25-
// Matches [MARC fields] 130, 240, 730; subfield $t in 700, 710, 711."
26-
// Seems to have the same behavior as the KTUT advanced search on the LoC website
27-
// https://catalog.loc.gov/vwebv/ui/en_US/htdocs/help/searchExamples.html#KTUT
28-
6 => _("Title (narrow)"),
29-
];
30-
31-
$author_attrs = [
32-
// Bib-1 Use, Author-name-personal (attribute 1004)
33-
// "A person's real name, pseudonym, title of nobility nickname, or initials.
34-
// (Differs from attribute "Author-name" in that personal name subject
35-
// headings are not included.)
36-
// [Matches MARC fields] 100, 400, 700, 800"
37-
// Seems similar to KPNC advanced search on LoC website.
38-
// https://catalog.loc.gov/vwebv/ui/en_US/htdocs/help/searchExamples.html#KPNC
39-
1004 => _("Author name (personal)"),
40-
41-
// Bib-1 Use, Author-name (attribute 1003).
42-
// "A personal or corporate author or a conference or meeting name.
43-
// (No subject name headings are included.)
44-
// [Matches MARC fields] 100, 110, 111, 400, 410, 411, 700, 710, 711, 800, 810, 811)"
45-
// That leads to broad matches, similar to the KNAM advanced search.
46-
// https://catalog.loc.gov/vwebv/ui/en_US/htdocs/help/searchExamples.html#KNAM
47-
1003 => _("Author name (all)"),
48-
];
49-
5012
$serial_attrs = [
5113
9 => _('LCCN'), // Library of Congress Control Number
5214
8 => _('ISSN'), // International Standard Serial Number
5315
7 => _('ISBN'), // International Standard Book Number
5416
];
5517

5618
$search_params = [
57-
'title' => ['type' => 'attr', 'attrs' => $title_attrs],
58-
'author' => ['type' => 'attr', 'attrs' => $author_attrs],
19+
'title' => ['type' => 'text', 'name' => _("Title (wide)")],
20+
'author' => ['type' => 'text', 'name' => _("Author name (all)")],
5921
'publisher' => ['type' => 'text', 'name' => _('Publisher')],
6022
'pubdate' => ['type' => 'text', 'name' => _('Publication Year (eg: 1912)')],
6123
'serial' => ['type' => 'attr', 'attrs' => $serial_attrs],
@@ -386,7 +348,7 @@ function display_record_table(MARCRecord $marc_record, bool $hide_nontext): void
386348

387349
function query_format()
388350
{
389-
global $title_attrs, $author_attrs, $serial_attrs;
351+
global $serial_attrs;
390352
// Build a Z39.50 Type-1 query.
391353
// See
392354
// https://www.loc.gov/z3950/agency/markup/09.html Type-1 and Type-101 Queries
@@ -409,8 +371,15 @@ function query_format()
409371
$fullquery = [];
410372

411373
if ($_REQUEST['title']) {
412-
$attr = get_enumerated_param($_REQUEST, 'title_attr', null, array_keys($title_attrs));
413-
$fullquery[] = sprintf('@attr 1=%s "%s"', $attr, $_REQUEST['title']);
374+
// Bib-1 Use, Title (attribute 4)
375+
// "A word, phrase, character, or group of characters, normally appearing in an item,
376+
// that names the item or the work contained in it.
377+
// Matches 130, 21X-24X, 440, 490, 730, 740, 830, 840, subfield $t in 400, 410, 410, 600,
378+
// 610, 611, 700, 710, 711, 800, 810, 811"
379+
// That leads to broad matches, similar to the KTIL LoC advanced search, but
380+
// sometimes is necessary due to missing fields in MARC records.
381+
// https://catalog.loc.gov/vwebv/ui/en_US/htdocs/help/searchExamples.html#KTIL
382+
$fullquery[] = sprintf('@attr 1=4 "%s"', $_REQUEST['title']);
414383
}
415384
if ($_REQUEST['author']) {
416385
// Convert author to "Surname, Forename" if it doesn't already contain a comma.
@@ -421,8 +390,13 @@ function query_format()
421390
$author = substr($author, $p) . ", " . substr($author, 0, $p);
422391
}
423392
}
424-
$attr = get_enumerated_param($_REQUEST, 'author_attr', null, array_keys($author_attrs));
425-
$fullquery[] = sprintf('@attr 1=%s "%s"', $attr, trim($author));
393+
// Bib-1 Use, Author-name (attribute 1003).
394+
// "A personal or corporate author or a conference or meeting name.
395+
// (No subject name headings are included.)
396+
// [Matches MARC fields] 100, 110, 111, 400, 410, 411, 700, 710, 711, 800, 810, 811)"
397+
// That leads to broad matches, similar to the KNAM advanced search.
398+
// https://catalog.loc.gov/vwebv/ui/en_US/htdocs/help/searchExamples.html#KNAM
399+
$fullquery[] = sprintf('@attr 1=1003 "%s"', trim($author));
426400
}
427401
if ($_REQUEST['serial']) {
428402
$attr = get_enumerated_param($_REQUEST, 'serial_attr', null, array_keys($serial_attrs));

0 commit comments

Comments
 (0)