Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subject heading remapping #88

Merged
merged 12 commits into from
Aug 23, 2024
Merged

Subject heading remapping #88

merged 12 commits into from
Aug 23, 2024

Conversation

niquerio
Copy link
Collaborator

@niquerio niquerio commented Aug 14, 2024

This PR adds logic for enabling subject heading remapping.

A "translation map" is generated from Authority records that explain the remapping rules. The map is set up like this:

[
  {
    "150": { "a": [ "Immigrant detention centers"]
    },
    "450": [
      { "a": [ "Alien detention centers" ] },
      { "a": [ "Detention centers, Alien" ] },
    ]
  }
]

So it is not a one-to-one mapping like other traject translation maps.

With this mapping, subject fields within a record are divided into the following groups: lc_subject_fields, remediable_subject_fields, already_remediated_subject_fields, and non_lc_subject_fields. With those groups, we can generate solr fields to enable Library Search to not show deprecated terms in the UI, but still enable searching on deprecated terms and grouping the appropriate items together.

@niquerio niquerio force-pushed the subject-heading-remapping branch 2 times, most recently from aae4851 to 09be055 Compare August 14, 2024 21:00
@niquerio niquerio marked this pull request as ready for review August 16, 2024 14:46
@niquerio niquerio requested a review from billdueber August 16, 2024 14:46
@niquerio niquerio force-pushed the subject-heading-remapping branch from a18f160 to b0b9687 Compare August 19, 2024 21:51
Translation map is a bit of a misnomer since more than a one to one
mapping. It's only the same in that it's some config that's generated
before doing indexing.
Subjects::Field determines whether or not a field is remediable or has
already been remediable and knows how to change it into its remediated
or deprecated form

Subjects::RemediationMap makes the SubjectHeadingRemediation
"Translation Map" into something Subjects::Field can work with.
Adds a method for finding the already remediated subject fields. It also
adds all of the helper methods. The complexity with saving saving fields
is so that the expensive normalization operations are done as few times
as possible.
The methods added are ones that are used to build the output for the
subjects macros.
Adds the non_lc_subject_fields and remediated_lc_subject_fields methods.
Also stores output from subject_fields and lc_subject_fields
remediated_lc_subjects and subject_browse_subjects are added to
Subjects. The subject macros are added for them as well, and the specs
are updated so that everything works.
Subjects handles figuring out what the facets are. There are two sets of
facet-like objects. One is topics, which has everything including
deprecated terms. It is used for searching. The other is subject_facets
which only has approved terms.
Saves the Subjects object for a record to the clipboard because there
are many expensive operations.

The commit also removes the skip_FAST macro because that logic has been
moved to the Subjects class
The delimiter need for Library Search is " -- " because of line breaking
problems. Catalog browse uses the LC standard of "--" without spaces.
topicAllStr exists in the record so that the full list of searchable
topics is viewable in Solr docs.

topics aren't copied into topicStr anymore because topicStr is now
populated by Subjects::subject_facets.

remediated_lc_subject_display is added so we can have a separate field
in catalog record displays.
@niquerio niquerio force-pushed the subject-heading-remapping branch from b0b9687 to b0db399 Compare August 23, 2024 16:45
@niquerio niquerio merged commit e2ae888 into main Aug 23, 2024
1 check passed
@niquerio niquerio deleted the subject-heading-remapping branch December 16, 2024 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant