Repository navigation
Fix advanced search for spaced external IDs and clarify v1 FundRef paths - #596
Merged
Merged
Conversation
Auto-quote unquoted external_ids.all / preferred values that contain whitespace so ISNI-style IDs match as a single keyword (ror-roadmap#71). When a legacy v1 path like external_ids.FundRef.all is used, include a hint pointing at the v2 fields (ror-roadmap#70). Refs ror-community/ror-roadmap#70, ror-community/ror-roadmap#71 Co-authored-by: Joseph Rhoads <jrhoads@users.noreply.github.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.
Purpose
Fix ror-community/ror-roadmap#71 so unquoted ISNI (and other space-containing) values work in
query.advanced, and improve the error for legacy v1 FundRef-style paths from ror-community/ror-roadmap#70 without adding field aliases.Approach
query.advancedbuilds an Elasticsearchquery_stringwithdefault_operator: and. Unquoted whitespace splits the value into multiple terms, so a keyword like0000 0001 2375 2908never matchesexternal_ids.all. Quoting already worked; we now auto-quote those values in Python before the query is built.Roadmap #70’s original
Fundreftemplate misspelling is gone under schema v2 (external_idsis an array of{type, all, preferred}). Old paths likeexternal_ids.FundRef.allremain illegal; the validator now explains the v2 fields to use instead.Key Modifications
rorapi/common/queries.py:quote_spaced_external_id_values()forexternal_ids.all/external_ids.preferred; apply it inbuild_search_queryafter NFC normalization. Clearer illegal-field message when the path looks likeexternal_ids.<Type>.(all|preferred).Important Technical Details
external_ids.allandexternal_ids.preferredare auto-quoted (values stop atAND/OR/NOT,), or end of string). Already-quoted values and values without whitespace are unchanged.0000000123752908); those are not indexed.external_ids.FundRef.all— correct v2 forms areexternal_ids.all:100000908orexternal_ids.type:fundref AND external_ids.all:100000908.Types of changes
Reviewer, please remember our guidelines:
Test plan
test-pr / testandflow-guardpass;ruffsoft-fails repo-wide withcontinue-on-error, unrelated)external_ids.all:0000 0001 2375 2908returnshttps://ror.org/019496w77(same as quoted); v2 FundRef query returnshttps://ror.org/02g8xhs57; legacyexternal_ids.FundRef.allerror includes the v2 hint