Skip to content

fix: Include lang-tagged altLabels in search index#13

Merged
mjbommar merged 2 commits into
mainfrom
fix/altlabel-lang-search
Mar 17, 2026
Merged

fix: Include lang-tagged altLabels in search index#13
mjbommar merged 2 commits into
mainfrom
fix/altlabel-lang-search

Conversation

@damienriehl

Copy link
Copy Markdown
Contributor

Summary

  • Bug: altLabels with xml:lang attribute (90% of all altLabels — 52,238 of 57,510) were added to translations but excluded from alternative_labels, making them invisible to search_by_label().
  • Fix: Always append to alternative_labels regardless of language tag, so e.g. searching "Patent Prosecution" correctly matches "Patent Registration Process" (which has altLabel "Patent Prosecution" with xml:lang="en-us").

Test plan

  • python -m pytest — all 38 tests pass
  • Verify: FOLIO().search_by_label("Patent Prosecution", include_alt_labels=True) returns "Patent Registration Process" with score 100

🤖 Generated with Claude Code

Damien Riehl and others added 2 commits March 16, 2026 21:30
altLabels with xml:lang attributes (90% of all altLabels — 52,238 of
57,510) were added to translations but excluded from alternative_labels,
making them invisible to search_by_label(). Now always append to
alternative_labels regardless of language tag, so searches like "Patent
Prosecution" correctly match "Patent Registration Process".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Prevent duplicate entries in alternative_labels when the same text
appears as both a lang-tagged and non-lang-tagged altLabel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mjbommar mjbommar merged commit b9a1a70 into main Mar 17, 2026
6 checks passed
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.

2 participants