diff --git a/search/src/main/scala/weco/api/search/services/WorksService.scala b/search/src/main/scala/weco/api/search/services/WorksService.scala index bbadaf98f..787e29f43 100644 --- a/search/src/main/scala/weco/api/search/services/WorksService.scala +++ b/search/src/main/scala/weco/api/search/services/WorksService.scala @@ -58,10 +58,17 @@ class WorksService(val elasticsearchService: ElasticsearchService)( searchResponse.map { case Right(resp) => { val workTypeAggregation = resp.aggregations.getAgg("workType").get - val workTypeBuckets = workTypeAggregation.data("buckets").asInstanceOf[List[Map[String, Any]]] + val workTypeBuckets = workTypeAggregation + .data("buckets") + .asInstanceOf[List[Map[String, Any]]] Right( - workTypeBuckets.map(bucket => bucket("key").asInstanceOf[String] -> bucket("doc_count").asInstanceOf[Int]).toMap + workTypeBuckets + .map( + bucket => + bucket("key").asInstanceOf[String] -> bucket("doc_count") + .asInstanceOf[Int]) + .toMap ) } case Left(err) => Left(err) diff --git a/search/src/test/scala/weco/api/search/works/WorksAggregationsTest.scala b/search/src/test/scala/weco/api/search/works/WorksAggregationsTest.scala index 58f0f6b12..c91ba5415 100644 --- a/search/src/test/scala/weco/api/search/works/WorksAggregationsTest.scala +++ b/search/src/test/scala/weco/api/search/works/WorksAggregationsTest.scala @@ -322,7 +322,7 @@ class WorksAggregationsTest extends AnyFunSpec with ApiWorksTestBase { { "count" : 1, "data" : { - "id" : "GCHQ" + "id" : "GCHQ", "label" : "GCHQ" }, "type" : "AggregationBucket" @@ -363,9 +363,7 @@ class WorksAggregationsTest extends AnyFunSpec with ApiWorksTestBase { "count" : 3, "data" : { "id" : "cc-by", - "label" : "Attribution 4.0 International (CC BY 4.0)", - "type" : "License", - "url" : "http://creativecommons.org/licenses/by/4.0/" + "label" : "Attribution 4.0 International (CC BY 4.0)" }, "type" : "AggregationBucket" }, @@ -373,9 +371,7 @@ class WorksAggregationsTest extends AnyFunSpec with ApiWorksTestBase { "count" : 2, "data" : { "id" : "cc-by-nc", - "label" : "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)", - "type" : "License", - "url" : "https://creativecommons.org/licenses/by-nc/4.0/" + "label" : "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)" }, "type" : "AggregationBucket" } @@ -419,8 +415,7 @@ class WorksAggregationsTest extends AnyFunSpec with ApiWorksTestBase { "count": 2, "data": { "label": "Closed stores", - "id": "closed-stores", - "type" : "Availability" + "id": "closed-stores" }, "type": "AggregationBucket" }, @@ -428,8 +423,7 @@ class WorksAggregationsTest extends AnyFunSpec with ApiWorksTestBase { "count" : 2, "data" : { "id" : "online", - "label" : "Online", - "type" : "Availability" + "label" : "Online" }, "type" : "AggregationBucket" }, diff --git a/search/src/test/scala/weco/api/search/works/filtering/FilterAndAggregateBySubjectTest.scala b/search/src/test/scala/weco/api/search/works/filtering/FilterAndAggregateBySubjectTest.scala index ea656caad..9b8a8c1c7 100644 --- a/search/src/test/scala/weco/api/search/works/filtering/FilterAndAggregateBySubjectTest.scala +++ b/search/src/test/scala/weco/api/search/works/filtering/FilterAndAggregateBySubjectTest.scala @@ -72,10 +72,8 @@ class FilterAndAggregateBySubjectTest case (count, label) => (count, s""" |{ - | "concepts" : [ - | ], - | "label" : "$label", - | "type" : "Subject" + | "id" : "$label", + | "label" : "$label" | } |""".stripMargin) } @@ -86,10 +84,8 @@ class FilterAndAggregateBySubjectTest val redundantFilterBucket: String = """ |{ - | "concepts" : [ - | ], - | "label" : "Psychology, Pathological", - | "type" : "Subject" + | "id" : "Psychology, Pathological", + | "label" : "Psychology, Pathological" | } |""".stripMargin val aggregationName: String = "subjects.label"