Skip to content

Comments

Call facets on pages where they are required#940

Merged
ashwinisukale merged 1 commit intomainfrom
enable-facets
Feb 12, 2026
Merged

Call facets on pages where they are required#940
ashwinisukale merged 1 commit intomainfrom
enable-facets

Conversation

@ashwinisukale
Copy link
Contributor

@ashwinisukale ashwinisukale commented Feb 5, 2026

https://github.com/datacite/product-backlog/issues/433

Summary

The DataCite API will stop returning /dois facet aggregations in meta by default. This PR updates all DOI list queries in bracco to explicitly request facets (and force-enable them) so the facet sidebar continues to work.

Changes

  • Added facets=... and disable-facets=false to /dois queries in:
    • Global DOIs index (app/routes/dois/index.js)
    • Provider DOIs (app/routes/providers/show/dois.js)
    • Repository DOIs (app/routes/repositories/show/dois/index.js)
    • User DOIs (app/routes/users/show/dois.js)
    • User profile page DOI meta query (app/routes/users/show.js)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates DOI-listing routes to explicitly request facet aggregations from the API so facet-driven UI elements (filters/sidebars/metrics) have the required meta data available.

Changes:

  • Add an explicit facets query parameter to multiple DOI queries.
  • Add 'disable-facets': 'false' to ensure facets are returned for those queries.
  • Apply this across global DOI index and scoped DOI pages (user/provider/repository contexts).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
app/routes/users/show/dois.js Requests facets for the user-scoped DOI list query.
app/routes/users/show.js Requests facets for the DOI meta query used on the user show route.
app/routes/repositories/show/dois/index.js Requests facets for the repository-scoped DOI list query.
app/routes/providers/show/dois.js Requests facets for the provider/consortium-scoped DOI list query.
app/routes/dois/index.js Requests facets for the global DOI index query.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +35 to +38
facets:
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',

'disable-facets': 'false'
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The facets list is duplicated verbatim across multiple routes in this PR. To avoid inconsistencies and simplify future updates, extract it to a shared constant (e.g., a util/service) and reference it from each route.

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +28
facets:
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',

'disable-facets': 'false'
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full facets list is hard-coded here and duplicated in several other routes. Consider extracting it into a shared constant/helper (and ideally limiting it to only the facets actually displayed for DOI lists) to prevent future drift and reduce payload size.

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +37
facets:
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',

'disable-facets': 'false'
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full facets list is hard-coded here and duplicated in several other routes. Consider extracting it into a shared constant/helper (and ideally limiting it to only the facets actually displayed for DOI lists) to prevent future drift and reduce payload size.

Copilot uses AI. Check for mistakes.
'user-id': user.get('id'),

facets:
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This DOI query now asks the API for many facet buckets. The DOI facets UI only uses a smaller subset (states/resourceTypes/published/created/registered/clients/affiliations/prefixes/certificates/schemaVersions/sources/linkChecksStatus). Consider requesting only the facets that are actually rendered on this page to reduce response size and facet computation cost.

Suggested change
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',
'states,resourceTypes,published,created,registered,clients,affiliations,prefixes,certificates,schemaVersions,sources,linkChecksStatus',

Copilot uses AI. Check for mistakes.
'client-id': this.modelFor('repositories/show').get('id'),

facets:
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This DOI query now asks for a broad set of facets, but the DOI facets UI only consumes a subset. Consider narrowing the facets param to the facets actually rendered for DOI lists to reduce response size and backend facet computation.

Suggested change
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',
'clients,providers,created,published,registered,resourceTypes,states,subjects,licenses',

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +37
facets:
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',

'disable-facets': 'false'
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This DOI query now requests many facet buckets, but the DOI facets UI only uses a subset. Consider trimming the facets list to what the UI renders to reduce backend facet work and response size.

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +29
facets:
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',

'disable-facets': 'false'
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full facets list is hard-coded here (and duplicated across multiple DOI routes). This makes it easy for routes to drift and increases maintenance cost when facets are added/removed. Consider extracting the facets list (and the disable-facets flag) into a shared constant/helper so all routes use a single source of truth.

Copilot uses AI. Check for mistakes.
sort: params.sort || '-updated',

facets:
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This route now requests a large set of facets, but the DOI facets UI (DoiList) only references a subset (e.g., states/resourceTypes/published/created/registered/clients/affiliations/prefixes/certificates/schemaVersions/sources/linkChecksStatus). Requesting extra facets can increase backend work and response size. Consider limiting the facets param to only the facets actually rendered/needed on this page.

Suggested change
'affiliations,certificates,citations,clients,created,downloads,fieldsOfScience,licenses,linkChecksStatus,prefixes,providers,published,registered,resourceTypes,schemaVersions,states,subjects,views',
'states,resourceTypes,published,created,registered,clients,affiliations,prefixes,certificates,schemaVersions,sources,linkChecksStatus',

Copilot uses AI. Check for mistakes.
@jrhoads
Copy link
Contributor

jrhoads commented Feb 10, 2026

Copilots comments on centralizing the settings and focusing on the facets that are used are relevant, but not stoppers for this PR. That could be scheduled for future work.

@ashwinisukale
Copy link
Contributor Author

ashwinisukale commented Feb 11, 2026

Issue I discussed in the call that, when I select some facet combination, I see error message but API does not give any error it returns empty array. I tried same combination on stage, I guess it existing behaviour https://doi.datacite.org/dois?created=2018&registered=2020&resource-type-id=service

@codycooperross
Copy link
Contributor

Issue I discussed in the call that, when I select some facet combination, I see error message but API does not give any error it returns empty array. I tried same combination on stage, I guess it existing behaviour https://doi.datacite.org/dois?created=2018&registered=2020&resource-type-id=service

This error seems to be happening because that API request returns 0 results: https://api.datacite.org/dois?affiliation=true&affiliation-id=&certificate=&client-id=&created=2018&include=client&link-check-status=&page[number]=1&page[size]=25&person-id=&prefix=&provider-id=&publisher=true&query=&registered=2020&resource-type-id=service&schema-version=&size=25&sort=-updated&source=&state=&year= So not a problem with your PR, I don't think—more an issue that it is possible to select facets that result in 0 results and also the way we report a 0 result query.

@ashwinisukale ashwinisukale merged commit 2e1b8e5 into main Feb 12, 2026
15 of 16 checks passed
@ashwinisukale ashwinisukale deleted the enable-facets branch February 12, 2026 09:36
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.

3 participants