PD-6176 Index version-of and funded-by external identifiers in Solr - #7652
Open
cryptalith wants to merge 1 commit into
Open
PD-6176 Index version-of and funded-by external identifiers in Solr#7652cryptalith wants to merge 1 commit into
cryptalith wants to merge 1 commit into
Conversation
Member
|
Task linked: PD-6176 Index funded-by and version-of identifiers |
Activity external identifiers are indexed into the profile Solr core as dynamic fields named <id-type>-<relationship>, but only self and part-of were usable in practice. funded-by was never indexed for any activity type and had no Solr field. version-of had a schema field and indexer support for research resources and peer reviews, but the works loop only ever checked SELF and PART_OF. Since works are the dominant activity type, every *-version-of field is empty in production today. - add the DYNAMIC_FUNDED_BY constant to both SolrConstants copies - add the fundedByIds map to OrcidSolrDocument, including equals/hashCode - index VERSION_OF and FUNDED_BY for works - index FUNDED_BY for research resources, resource items and peer reviews - declare the *-funded-by dynamic field in the profile schema Fundings are deliberately left alone. They contribute no relationship based identifiers at all, so funding external identifiers are invisible to self and part-of queries too, but fixing that would change the results of queries that already work today and is not what this ticket asked for. Funding grant numbers remain searchable through the existing 'grant-numbers' field. Raised separately for product. Note that the profile core uses a managed schema, so the schema.xml change here does not update an already provisioned core. The dynamic field has to be applied to the running cores before this code is deployed: Solr rejects a document containing an undefined field with a 400, and the listener sends the whole document via addBean, so the entire record would fail to index. Also adds test coverage for the relationship maps, which had none.
cryptalith
force-pushed
the
lmendoa/PD-6176-index-funded-by-version-of
branch
from
August 22, 2026 02:36
f2c59ce to
e1e3a2a
Compare
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.
Closes PD-6176 — https://orcid.clickup.com/t/9014437828/PD-6176
Problem
Activity external identifiers are indexed into the
profileSolr core as dynamic fields named<id-type>-<relationship>, so people can search:Only
selfandpart-ofactually work. The two halves of this ticket turned out to be different problems:funded-bywas never implemented at any layer — no constant, no document field, no Solr field.version-ofalready had a Solr field and indexer support for research resources and peer reviews, but the works loop only ever checkedSELFandPART_OF. Since works are the dominant activity type, every*-version-offield is empty in production.Measured with a field-existence query (
q=<field>:[* TO *]) against/v3.0/search/. Note/csv-search/silently swallows Solr errors and returns empty for any garbage field name, so it can't be used to test this.doi-selfdoi-part-ofdoi-version-of*-funded-by(all types)Changes
DYNAMIC_FUNDED_BYin bothSolrConstantscopiesfundedByIdsmap onOrcidSolrDocument, includingequals/hashCodeVERSION_OF+FUNDED_BYindexed for worksFUNDED_BYindexed for research resources, resource items and peer reviews*-funded-bydynamic field declared in the profile schemaNo
orcid-modelchange is needed —Relationshipalready ships all four values.Fundings are deliberately out of scope
Fundings contribute no relationship based identifiers at all, so funding external identifiers are invisible to
selfandpart-ofqueries too. That is a real gap, but fixing it would change the results of queries that already work today across millions of records, which is a different risk profile from adding brand new fields and is not what this ticket asked for. Funding grant numbers remain searchable through the existinggrant-numbersfield.Raised separately on the ticket for product to consider. A test asserts the exclusion so it is not reintroduced by accident.
The Solr dynamic field must be applied to the running cores BEFORE this is deployed.
The profile core uses a managed schema (
ClassicIndexSchemaFactoryis commented out insolrconfig.xml), so theschema.xmlchange in this PR does not update an already provisioned core. Verified locally: on startup Solr convertsschema.xmlintomanaged-schemaand renames the original toschema.xml.bak.There is no
AddSchemaFieldsUpdateProcessorFactory, so unknown fields are not auto-created. Verified locally against two Solr 8.0.0 instances with the same document:Because the listener sends the whole document via
addBean, that 400 fails the entire record, not just the unknown field. Deploying this before the schema would break indexing for every record carrying afunded-byidentifier.Applying the field is hot, auto-reloads the core, and needs no reindex:
Backfill
Solr documents are fully replaced on update, so existing documents only gain the new fields once re-indexed. Backfill script is in a companion ORCID-Internal PR: https://github.com/ORCID/ORCID-Internal/pull/736
Testing
orcid-utilsandorcid-message-listenerexpected:<[10.1000/version-of]> but was:<null>)addBean, then queried —doi-version-of,doi-funded-by,grant_number-funded-byanddoi-selfall returned the recordNotes
*-funded-byvalues will also flow into the catch-alltextfield via the existing<copyField source="*" dest="text"/>, consistent with how the other three relationships already behave.