Add filter for sdgs
This commit is contained in:
parent
d838a051c4
commit
f9602e59c2
|
@ -80,11 +80,11 @@ public class ResearchProductsRequest {
|
|||
private String[] citationCountClass;
|
||||
|
||||
// publication related filters
|
||||
// @Parameter(description = "Retrieves publications classified with the respective Sustainable Development Goal number (for further information check <a href='https://sdgs.un.org/goals' target='_blank'>here</a>); the values for SDGs are numbers from 1 to 17 `[Only for publications]`", array = @ArraySchema(schema = @Schema(type = "integer")))
|
||||
// // TODO: fix validation
|
||||
//// @Min(value = 1)
|
||||
//// @Max(value = 17)
|
||||
// private Integer[] sdg;
|
||||
@Parameter(description = "Retrieves publications classified with the respective Sustainable Development Goal number (for further information check <a href='https://sdgs.un.org/goals' target='_blank'>here</a>); the values for SDGs are numbers from 1 to 17 `[Only for publications]`", array = @ArraySchema(schema = @Schema(type = "integer")))
|
||||
// TODO: fix validation
|
||||
@Min(value = 1)
|
||||
@Max(value = 17)
|
||||
private Integer[] sdg;
|
||||
//
|
||||
// @Parameter(description = "Retrieves publications classified with the respective Field of Science classification value; for more information about the FOS classification values check <a href='https://graph.openaire.eu/docs/assets/files/athenarc_fos_hierarchy-3b6e1c7197e46bd3a3e9790115a8dec9.json' target='_blank'>here</a> `[Only for publications]`", array = @ArraySchema(schema = @Schema(type = "string")))
|
||||
// private String[] fos;
|
||||
|
|
|
@ -240,12 +240,13 @@ public interface ResearchProductsRequestMapper {
|
|||
fqList.add(String.format(solrFieldMapping.get("instanceType"), Utils.escapeAndJoin(src.getInstanceType(), "OR", false)));
|
||||
}
|
||||
|
||||
// if (src.getSdg() != null) {
|
||||
// String[] sdgValues = Arrays.stream(src.getSdg())
|
||||
// .map(String::valueOf)
|
||||
// .toArray(String[]::new);
|
||||
// fqList.add(String.format(solrFieldMapping.get("sdg"), Utils.escapeAndJoin(sdgValues, "OR", false)));
|
||||
// }
|
||||
if (src.getSdg() != null) {
|
||||
String[] sdgValues = Arrays.stream(src.getSdg())
|
||||
.map(sdg -> sdg + ".*") // Append ".*" to match the sdg numeric prefix
|
||||
.toArray(String[]::new);
|
||||
|
||||
fqList.add(String.format(solrFieldMapping.get("sdg"), String.join(" OR ", sdgValues)));
|
||||
}
|
||||
//
|
||||
// if (!Utils.isNullOrEmpty(src.getFos())) {
|
||||
// fqList.add(String.format(solrFieldMapping.get("fos"), Utils.escapeAndJoin(src.getFos(), "OR", false)));
|
||||
|
|
Loading…
Reference in New Issue