Skip to content

Index slim client and provider snapshots on DOIs - #1603

Open
jrhoads wants to merge 1 commit into
masterfrom
opensearch-doi-simplified
Open

jrhoads wants to merge 1 commit into
masterfrom
opensearch-doi-simplified

Conversation

@jrhoads

@jrhoads jrhoads commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

DOI OpenSearch documents should store only the client and provider fields needed for search and include=client / include=provider, instead of the full associated JSON.

Approach

  • Replace client.as_indexed_json and provider.as_indexed_json on a DOI with explicit snapshots.
  • Keep is_active on both snapshots. ClientSerializer and ProviderSerializer call is_active.getbyte when those relationships are included.

Key Modifications

  • app/models/doi.rb: Added doi_client_indexed_json and doi_provider_indexed_json, and used them from as_indexed_json.
  • spec/models/doi_spec.rb: The snapshot example uses a supported certificate (CoreTrustSeal), an integer opendoar_id, and expects is_active on both snapshots.

Important Technical Details

  • GET /dois?include=client serializes the client embedded in the DOI document. Omitting is_active makes that request return 400 (undefined method 'getbyte' for nil).
  • client.opendoar_id is an integer column, so the indexed value is an integer.
  • Client#check_certificate only allows the supported certificate names, including CoreTrustSeal.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

@jrhoads
jrhoads requested review from a team and digitaldogsbody October 2, 2026 13:04
DOI documents store an explicit client and provider field list instead
of the full associated JSON. is_active stays on both snapshots because
include=client and include=provider call is_active.getbyte.

Co-authored-by: Joseph Rhoads <jrhoads@users.noreply.github.com>
@cursor
cursor Bot force-pushed the opensearch-doi-simplified branch from e4214a4 to 0b23a72 Compare October 8, 2026 12:16
@cursor cursor Bot changed the title Optimize OpenSearch creator aggregations and refine DOI indexed fields Index slim client and provider snapshots on DOIs Oct 8, 2026
@jrhoads
jrhoads requested a review from richardhallett October 8, 2026 12:46
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