Skip to content

Commit

Permalink
Bug fixes #5825
Browse files Browse the repository at this point in the history
  • Loading branch information
StepanBrychta committed Nov 22, 2024
1 parent ed71af6 commit dafa6c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
4 changes: 0 additions & 4 deletions common/search/src/test/resources/WorksIndexConfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ object AggregationMapping {
firstBucket <- labelBuckets.headOption
} yield firstBucket

val key = bucket.key.toString
val key = bucket.key.as[String].toOption.get

// For label-based aggregations (which do not contain sub-aggregation buckets), set the label equal to the key.
val label = firstLabelBucket.map(_.key).getOrElse(key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ object WorksRequestBuilder
.field(s"$nestedFieldPath.id")
.subAggregations(termsAgg("labels", s"$nestedFieldPath.label").size(1))

// private def toLabelBasedAggregation(
// aggregationName: String,
// idFieldPath: String,
// size: Int
// ) =
// TermsAggregation(aggregationName).size(size).field(idFieldPath)
private def toLabelBasedAggregation(
aggregationName: String,
idFieldPath: String,
size: Int
) =
TermsAggregation(aggregationName).size(size).field(idFieldPath)

private def toAggregation(aggReq: WorkAggregationRequest) = aggReq match {
// Note: we want these aggregations to return every possible value, so we
Expand All @@ -98,9 +98,9 @@ object WorksRequestBuilder
toIdBasedAggregation("format", "aggregatableValues.workType", size = 30)

case WorkAggregationRequest.ProductionDate =>
toIdBasedAggregation(
toLabelBasedAggregation(
"productionDates",
"aggregatableValues.production.dates",
"aggregatableValues.production.dates.label",
size = 10
).minDocCount(1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class AggregationsTest
"E-videos",
"Videos",
"Archives and manuscripts",
"Born-digital archives",
"Audio",
"E-journals",
"Pictures",
Expand All @@ -121,7 +122,6 @@ class AggregationsTest
"Standing order",
"E-books",
"Student dissertations",
"Manuscripts",
"Web sites"
)
}
Expand Down

0 comments on commit dafa6c8

Please sign in to comment.