fix: Include lang-tagged altLabels in search index#13
Merged
Conversation
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>
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.
Summary
altLabelswithxml:langattribute (90% of all altLabels — 52,238 of 57,510) were added totranslationsbut excluded fromalternative_labels, making them invisible tosearch_by_label().alternative_labelsregardless of language tag, so e.g. searching "Patent Prosecution" correctly matches "Patent Registration Process" (which hasaltLabel"Patent Prosecution" withxml:lang="en-us").Test plan
python -m pytest— all 38 tests passFOLIO().search_by_label("Patent Prosecution", include_alt_labels=True)returns "Patent Registration Process" with score 100🤖 Generated with Claude Code