https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43489 Bug ID: 43489 Summary: Thesaurus filtering should be scoped by auth_type, not by MARC21 tag position Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: MARC Authority data support Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Depends on: 43483 Target Milestone: --- Bug 43483 fixed the most common case of this problem (a blank/undefined 2nd indicator on a 6XX field being coerced to the literal thesaurus value 'notdefined'). This bug tracks the more thorough underlying fix. C4::Heading::MARC21::parse_heading decides whether to compute a thesaurus value purely from the MARC tag position: my $thesaurus = $tag =~ m/6../ ? _get_subject_thesaurus($field) : undef; That means any 6XX occurrence of a name heading (100/110/111/130 used as 600/610/611/630) can still get a thesaurus constraint applied during authority matching whenever indicator 2 is explicitly coded (0-7), even after bug 43483's fix for the blank-indicator case. For example: 100 1_ $a Goddard, Giles 600 10 $a Goddard, Giles $x Criticism and interpretation (indicator 2 = 0, i.e. lcsh explicitly coded) will still search/create against a 'lcsh' thesaurus constraint for the 600 occurrence, while the 100 occurrence has no constraint at all. If the authority created via the 100 field was not recorded with an explicit lcsh thesaurus, the two can again end up as separate authority records, same symptom as bug 43483, just via a narrower path. The real distinction is not "is this tag a 6XX" but "does this heading's auth_type represent a controlled vocabulary term, or a named real-world entity". MARC's indicator-2 thesaurus code exists to disambiguate genuinely separate subject vocabularies (LCSH vs MeSH vs Sears etc) that may define overlapping terms. It has no equivalent meaning for personal names, corporate names, meeting names or uniform titles: NACO name authority records are reused identically regardless of whether the name functions as a main entry (1XX), added entry (7XX/8XX) or subject added entry (6XX) in a given bibliographic record. There is exactly one authority record per real-world entity, not one per (entity, thesaurus) pair. Suggested solution: Replace the tag-position check in parse_heading with an auth_type check. Introduce a small table of auth_types for which a thesaurus is a meaningful concept - genuine subject/vocabulary terms: TOPIC_TERM, GEOGR_NAME, CHRON_TERM, GENRE/FORM, MED_PERFRM and only call _get_subject_thesaurus for a 6XX field whose auth_type is in that set. Name-entity auth_types - PERSO_NAME, CORPO_NAME, MEETI_NAME, UNIF_TITLE, NAME_EVENT - would then never get a thesaurus constraint, in any tag position, even when indicator 2 is explicitly coded. This is more thorough and correct than the blank-indicator fix in bug 43483 because: 1. It closes the remaining gap: an explicitly coded thesaurus indicator on a name-type 6XX field no longer fragments matching either, not just the blank/undefined case. 2. It matches real cataloguing practice (NACO/LCNAF): the thesaurus concept is a property of subject vocabularies, not of names. Scoping by auth_type encodes that directly instead of relying on tag position as a proxy for it. 3. It is symmetric by construction for every current and future name auth_type, rather than requiring each edge case (blank indicator, explicit indicator, UNIMARC vs MARC21) to be patched individually as it is discovered, which is how bug 33277 and bug 43483 each arose. 4. Genuine subject/vocabulary auth_types (TOPIC_TERM, GEOGR_NAME, CHRON_TERM, GENRE/FORM, MED_PERFRM) keep their existing, correct thesaurus-scoped behaviour, so this does not reopen bug 33277 or affect bug 39503's 6XX-to-6XX collapsing logic. C4::Heading::UNIMARC::parse_heading already always returns thesaurus undef, so UNIMARC is unaffected by either bug and needs no change. Test plan: 1. Turn on LinkerConsiderThesaurus, AutoLinkBiblios and AutoCreateAuthorities. 2. Catalogue a bibliographic record with the same personal name in a 100 field and a 600 field where indicator 2 is explicitly coded (e.g. 0 for lcsh), with no existing matching authority. 3. Confirm only one authority record is created and used by both fields, the same as the blank-indicator case fixed by bug 43483. 4. Confirm existing subject heading matching for TOPIC_TERM, GEOGR_NAME, CHRON_TERM, GENRE/FORM and MED_PERFRM auth_types is unchanged (t/db_dependent/Heading.t "_search tests"). Related bugs: Bug 43483 -- Authority linker treats the same name heading differently in 6XX vs 1XX/7XX. This bug depends on it and generalises its fix from "blank indicator" to "any indicator, for name-type auth_types". Bug 33277 -- Do not search using thesaurus when linking non 6XX fields. The auth_type-based check keeps this behaviour for name-type auth_types, so this is not reopened. Bug 39503 -- Linker should always respect thesaurus with LinkerConsiderThesaurus on. Addresses 6XX-to-6XX matching for subject/vocabulary auth_types, unaffected by this proposal. Bug 41714 -- MARC21 authorities thesaurus link hardcoded. Makes the tag-to-auth_type table configurable via frameworks; the auth_type-based thesaurus check proposed here would need to read from that configurable mapping rather than the hardcoded one, if 41714 lands first. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43483 [Bug 43483] Authority linker treats the same name heading differently in 6XX vs 1XX/7XX -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.