diff --git a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetsSearchService.java b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetsSearchService.java index 3de7088..3ef5ec9 100644 --- a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetsSearchService.java +++ b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/BeaconDatasetsSearchService.java @@ -76,15 +76,15 @@ public DatasetsSearchResponse search(DatasetSearchQuery query, String accessToke return datasetsSearchService.search(query, accessToken); } - var resultsets = queryOnBeaconIfThereAreBeaconFilters(beaconAuthorization, query); + var resultSets = queryOnBeaconIfThereAreBeaconFilters(beaconAuthorization, query); var datasetsSearchResponse = queryOnCkanIfThereIsNoBeaconFilterOrResultsetsIsNotEmpty( accessToken, query, - resultsets + resultSets ); - return enhanceDatasetsResponse(beaconAuthorization, datasetsSearchResponse, resultsets); + return enhanceDatasetsResponse(beaconAuthorization, datasetsSearchResponse, resultSets); } private String retrieveBeaconAuthorization(String accessToken) { @@ -174,30 +174,30 @@ private DatasetSearchQuery enhanceQueryFacets( private DatasetsSearchResponse enhanceDatasetsResponse( String beaconAuthorization, - DatasetsSearchResponse datasetsSearchReponse, + DatasetsSearchResponse datasetsSearchResponse, List resultSets ) { var facetGroupCount = new HashMap(); facetGroupCount.put(BEACON_FACET_GROUP, resultSets.size()); - if (isNotEmpty(datasetsSearchReponse.getFacetGroupCount())) { - facetGroupCount.putAll(datasetsSearchReponse.getFacetGroupCount()); + if (isNotEmpty(datasetsSearchResponse.getFacetGroupCount())) { + facetGroupCount.putAll(datasetsSearchResponse.getFacetGroupCount()); } var facetGroups = new ArrayList(); facetGroups.add(beaconFilteringTermsService.listFilteringTerms(beaconAuthorization)); - if (isNotEmpty(datasetsSearchReponse.getFacetGroups())) { - facetGroups.addAll(datasetsSearchReponse.getFacetGroups()); + if (isNotEmpty(datasetsSearchResponse.getFacetGroups())) { + facetGroups.addAll(datasetsSearchResponse.getFacetGroups()); } var results = List.of(); - if (isNotEmpty(datasetsSearchReponse.getResults())) { + if (isNotEmpty(datasetsSearchResponse.getResults())) { var recordCounts = resultSets.stream() .collect(toMap( BeaconResultSet::getId, BeaconResultSet::getResultsCount )); - results = datasetsSearchReponse.getResults() + results = datasetsSearchResponse.getResults() .stream() .map(it -> it.toBuilder() .recordsCount(recordCounts.get(it.getIdentifier())) @@ -205,7 +205,7 @@ private DatasetsSearchResponse enhanceDatasetsResponse( .toList(); } - return datasetsSearchReponse.toBuilder() + return datasetsSearchResponse.toBuilder() .facetGroupCount(facetGroupCount) .facetGroups(facetGroups) .results(results) diff --git a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapper.java b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapper.java index be27c5f..61feab0 100644 --- a/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapper.java +++ b/src/main/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapper.java @@ -48,7 +48,7 @@ public RetrievedDataset from(CkanPackage ckanPackage) { .accessRights(value(ckanPackage.getAccessRights())) .conformsTo(values(ckanPackage.getConformsTo())) .provenance(ckanPackage.getProvenance()) - .spatial(value(ckanPackage.getSpatial())) + .spatial(value(ckanPackage.getSpatialUri())) .distributions(distributions(ckanPackage)) .keywords(keywords(ckanPackage)) .build(); diff --git a/src/main/openapi/ckan.yaml b/src/main/openapi/ckan.yaml index d0a44be..22450f3 100644 --- a/src/main/openapi/ckan.yaml +++ b/src/main/openapi/ckan.yaml @@ -185,7 +185,7 @@ components: $ref: "#/components/schemas/CkanValueLabel" provenance: type: string - spatial: + spatial_uri: $ref: "#/components/schemas/CkanValueLabel" resources: type: array diff --git a/src/test/java/io/github/genomicdatainfrastructure/discovery/api/DatasetSearchTest.java b/src/test/java/io/github/genomicdatainfrastructure/discovery/api/DatasetSearchTest.java index 22f250f..7f7a0ce 100644 --- a/src/test/java/io/github/genomicdatainfrastructure/discovery/api/DatasetSearchTest.java +++ b/src/test/java/io/github/genomicdatainfrastructure/discovery/api/DatasetSearchTest.java @@ -70,7 +70,7 @@ void can_search_datasets_with_beacon_filters() { .post("/api/v1/datasets/search") .then() .statusCode(200) - .body("count", equalTo(1)) + .body("count", equalTo(1167)) .body("results[0].recordsCount", equalTo(64)); } diff --git a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java index 5bef995..b6a6631 100644 --- a/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java +++ b/src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java @@ -85,7 +85,7 @@ void can_parse() { .name("conforms") .build())) .provenance("provenance") - .spatial(CkanValueLabel.builder() + .spatialUri(CkanValueLabel.builder() .displayName("spatial") .name("uri") .build()) diff --git a/src/test/resources/mappings/package_search.json b/src/test/resources/mappings/package_search.json index 022dfc9..2879c04 100644 --- a/src/test/resources/mappings/package_search.json +++ b/src/test/resources/mappings/package_search.json @@ -282,7 +282,7 @@ ], "creator_user_id": "f2687934-1127-4c61-ab21-982cb91d7c80", "id": "0ddd7a13-ee11-4e5d-bbff-34e04a6a7949", - "identifier": "brainmriwml_vu", + "identifier": "27866022694497975", "isopen": false, "language": [ {