Skip to content

Conversation

@jrcastro2
Copy link
Contributor

// CDS-RDM is free software; you can redistribute it and/or modify it under
// the terms of the MIT License; see LICENSE file for more details.

export const apiConfig = (endpoint, baseQuery) => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

just for my understanding: do we need the custom function for this? isn't there one already somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main point of having this is that I am using the interceptors to enable the searchbar, and this is unique for this case. Without this we cannot hide the default query - needed to filter only related records - from the user input component, so we need to use the interceptors to build it with the user input query. I checked the hiddenParams but this doesn't allow queries, it works similar to filters, unless I am missing something.

Comment on lines +15 to +26
const layoutProps = (result) => {
return {
accessStatusId: _get(result, "ui.access_status.id", "open"),
accessStatus: _get(result, "ui.access_status.title_l10n", "Open"),
accessStatusIcon: _get(result, "ui.access_status.icon", "unlock"),
createdDate: _get(result, "ui.created_date_l10n_long", "Unknown date"),
creators: _get(result, "ui.creators.creators", []).slice(0, 3),
resourceType: _get(result, "ui.resource_type.title_l10n", "No resource type"),
title: _get(result, "metadata.title", "No title"),
link: _get(result, "links.self_html", "#"),
};
};
Copy link
Contributor

Choose a reason for hiding this comment

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

could this part be imported from somewhere so we don't need to maintain it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless I am mistaken there is no other place we can import this from. I see that we usually do it on the cmp itself, f.e. check here RecordsResultsListItem from invenio-app-rdm. Not sure how reusable this is, as different cmps might want to display different things. I am happy to move this somewhere more resusable. If you think we should, let me know where we should do it, invenio-rdm-records or invenio-app-rdm (or somewhere else?)

# Part 1: Records that this record references (forward)
# Search by record id using the CDS identifier
for cds_id in cds_related_ids:
query_parts.append(f'id:"{cds_id}"')
Copy link
Contributor

@kpsherva kpsherva Dec 17, 2025

Choose a reason for hiding this comment

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

this might be a bit tricky, because we now have a mix of old CDS recids and new pids in this field. The old recids sometimes point to the new platform, but sometimes they point to the old (f.e. if record was published in a conference, it will still refer to the legacy conference record).
My point is if you search for id:123456, even if the record is migrated, search will not find it, because it has a new recid.
If you have old recid pattern, you need to search also in identifiers.identifier:{cds_id}
if it is a new pid pattern, this is correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Thanks for this, I fixed it 👍

# Exclude the current record and only show published records
final_query = f'({combined_query}) AND is_published:true NOT id:"{record_id}"'

return final_query
Copy link
Contributor

@kpsherva kpsherva Dec 17, 2025

Choose a reason for hiding this comment

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

is there any way to find sibling references too? fe
I am on detail page of record A.
I find record B references record A.
there is also record C which references B but not A.
Can I include record C in this search too? Should I? tbd, ping @zzacharo @ntarocco

Copy link
Contributor

Choose a reason for hiding this comment

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

Too complicated no? Do you have any specific use case in mind? Otherwise, I would keep it simple maybe for now i.e only direct relations X -> A, and A -> X.

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.

4 - Show related records on landing page (based on related identifiers)

3 participants