Add relHostingDataSourceId filter for research products

This commit is contained in:
Serafeim Chatzopoulos 2024-06-12 19:03:45 +03:00
parent 90f3e32d91
commit 694b25c999
2 changed files with 8 additions and 0 deletions

View File

@ -130,6 +130,9 @@ public class ResearchProductsRequest {
@Parameter(description = "Retrieve research products connected to a project that has the given funding identifier", array = @ArraySchema(schema = @Schema(type = "string")))
private String[] relProjectFundingStreamId;
@Parameter(description = "Retrieve research products hosted by the data source (with OpenAIRE id)", array = @ArraySchema(schema = @Schema(type = "string")))
private String[] relHostingDataSourceId;
@Min(value = 1)
@Parameter(description = "Page number of the results", schema = @Schema(defaultValue = "1", type = "integer"))
private int page = 1;

View File

@ -54,6 +54,7 @@ public interface ResearchProductsRequestMapper {
Map.entry("hasProjectRel", "relprojectid:[* TO *]"),
Map.entry("relProjectFundingShortName", "relfundershortname:(%s)"),
Map.entry("relProjectFundingStreamId", "relfundinglevel0_name:(%s) OR relfundinglevel1_name:(%s) OR relfundinglevel2_name:(%s)"),
Map.entry("relHostingDataSourceId", "resulthostingdatasourceid:(%s)"),
// only for publications
Map.entry("instanceType", "instancetypename:(%s)"),
@ -193,6 +194,10 @@ public interface ResearchProductsRequestMapper {
fqList.add(String.format(solrFieldMapping.get("relProjectFundingStreamId"), relProjectFundingStreamId, relProjectFundingStreamId, relProjectFundingStreamId));
}
if (!Utils.isNullOrEmpty(src.getRelHostingDataSourceId())) {
fqList.add(String.format(solrFieldMapping.get("relHostingDataSourceId"), Utils.escapeAndJoin(src.getRelHostingDataSourceId(), "OR", false)));
}
// Only for publications
if (!Utils.isNullOrEmpty(src.getInstanceType())) {
fqList.add(String.format(solrFieldMapping.get("instanceType"), Utils.escapeAndJoin(src.getInstanceType(), "OR", false)));