Repository navigation
Support permanent redirects and dotted finding aid IDs - #125
Open
gkostin1966 wants to merge 10 commits into
Open
gkostin1966 wants to merge 10 commits into
gkostin1966 wants to merge 10 commits into
Conversation
Replaced the Rails-only normalizer override with UmArclight::NormalizedId, loaded directly by standalone Traject and Rails ingestion. Canonicalized collection and component Solr IDs to lowercase while preserving dots. Added canonical redirects for mixed-case current IDs, historical IDs, downloads, and hierarchy routes. Redirect chains resolve directly to the newest ID and preserve query parameters. Normalized deletion inputs and retained safe nested-block deletion through root. Removed the unrelated README change. Expanded coverage for standalone normalization, mixed-case components, chained redirects, query parameters, downloads, hierarchy routes, map casing, and cycles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support permanent redirects and dotted finding aid IDs
Summary
This change adds permanent redirects for finding aids whose EAD IDs have changed and establishes one canonical identifier policy throughout the application.
Finding aid IDs may change for several reasons:
The application now treats the redirect map as a history of exact old-to-new ID changes and returns an HTTP
301 Moved Permanentlyresponse for obsolete IDs. Redirect chains are resolved directly to the newest ID so clients and search engines do not need to traverse multiple redirects.Canonical identifier policy
Solr document IDs are now the canonical operational identifiers used by routes, downloads, generated artifacts, indexing jobs, and deletion jobs.
Canonical Solr IDs:
For example:
The original EAD ID remains available in
ead_ssias source metadata, including its original capitalization. Application behavior no longer depends on the rawead_ssivalue.The custom
UmArclight::NormalizedIdclass is loaded directly by the Traject configuration. This is important because some indexing commands execute Traject as a standalone process and do not load Rails initializers. Loading the normalizer from the Traject configuration ensures that all indexing paths produce the same IDs.Component reference IDs are also lowercased during indexing so collection and component URLs follow the same canonical-ID policy.
Permanent redirects
config/redirect_map.rbstores lowercase old-to-new ID mappings. It supports both legacy normalization redirects and stakeholder-requested EAD ID changes.For a rename history such as:
requests for
A,B, orCreceive a single permanent redirect toD.The redirect resolver:
while preserving the component suffix.
An exact redirect-map entry takes precedence over component-prefix matching.
When multiple historical finding-aid IDs overlap, the resolver uses the
longest matching root.
Mixed-case requests for current IDs are also redirected to their lowercase canonical URL. This prevents case-sensitive Solr lookups from returning a 404 for an otherwise valid finding aid.
Redirect behavior applies to:
Existing query parameters are retained in redirected URLs.
Routing
Catalog routes now accept the complete non-slash path segment as
:id. This prevents Rails from interpreting a dot in an ID as a format separator.Known historical IDs and noncanonical mixed-case IDs are routed to
catalog#permanent_id_redirect. Lowercase current IDs continue to use the normal Blacklightcatalog#showroute.The redirect is implemented at the HTTP layer rather than through synthetic Solr documents. This provides a real
301 Moved Permanentlyresponse without introducing redirect-only records into search results, facets, sitemaps, or other Solr-backed features.Artifact and deletion behavior
SolrDocument#finding_aid_idreturns the root Solr ID:_root_collection ID.XML, HTML, PDF, and temporary package filenames now use this canonical finding aid ID instead of the raw EAD ID.
Finding aid deletion now removes the complete nested Solr document block using
_root_. The supplied ID is normalized and Solr-escaped before the delete query is sent.Redirect map safeguards
The redirect map is frozen and has automated checks that:
The resolver also detects cycles at runtime and raises an explicit error rather than looping indefinitely.
Sample data
Four Bentley sample EAD files with dotted IDs were added:
umich-bhl-87265.0umich-bhl-87265.4umich-bhl-87265.11umich-bhl-87265.25These provide representative data for verifying indexing, routing, and artifact behavior with dotted finding aid IDs.
Deployment considerations
This changes the canonical Solr ID format for records whose prior IDs contained dots or uppercase characters.
Deployment requires:
The redirect map preserves access to obsolete public URLs after the new index is deployed.
Test coverage
Coverage includes:
ead_ssi.