Add filter for sdgs

This commit is contained in:
Serafeim Chatzopoulos 2024-06-14 18:43:58 +03:00
parent d838a051c4
commit f9602e59c2
2 changed files with 12 additions and 11 deletions

View File

@ -80,11 +80,11 @@ public class ResearchProductsRequest {
private String[] citationCountClass; private String[] citationCountClass;
// publication related filters // 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"))) @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 // TODO: fix validation
//// @Min(value = 1) @Min(value = 1)
//// @Max(value = 17) @Max(value = 17)
// private Integer[] sdg; 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"))) // @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; // private String[] fos;

View File

@ -240,12 +240,13 @@ public interface ResearchProductsRequestMapper {
fqList.add(String.format(solrFieldMapping.get("instanceType"), Utils.escapeAndJoin(src.getInstanceType(), "OR", false))); fqList.add(String.format(solrFieldMapping.get("instanceType"), Utils.escapeAndJoin(src.getInstanceType(), "OR", false)));
} }
// if (src.getSdg() != null) { if (src.getSdg() != null) {
// String[] sdgValues = Arrays.stream(src.getSdg()) String[] sdgValues = Arrays.stream(src.getSdg())
// .map(String::valueOf) .map(sdg -> sdg + ".*") // Append ".*" to match the sdg numeric prefix
// .toArray(String[]::new); .toArray(String[]::new);
// fqList.add(String.format(solrFieldMapping.get("sdg"), Utils.escapeAndJoin(sdgValues, "OR", false)));
// } fqList.add(String.format(solrFieldMapping.get("sdg"), String.join(" OR ", sdgValues)));
}
// //
// if (!Utils.isNullOrEmpty(src.getFos())) { // if (!Utils.isNullOrEmpty(src.getFos())) {
// fqList.add(String.format(solrFieldMapping.get("fos"), Utils.escapeAndJoin(src.getFos(), "OR", false))); // fqList.add(String.format(solrFieldMapping.get("fos"), Utils.escapeAndJoin(src.getFos(), "OR", false)));