Skip to content

Commit

Permalink
Minor cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
anti-social authored Jan 17, 2024
1 parent ad701d4 commit c17ecf9
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ class PreparedFacetExpressionFilter(

val results = facetFilterExprs.map { facetFilterExpr ->
val filterAgg = parsedAggs[makeAggName(facetFilterExpr.name)]
val docCount = if (filterAgg is SingleBucketAggResult)
val docCount = if (filterAgg is SingleBucketAggResult) {
filterAgg.docCount
else (filterAgg as LongValueAggResult).value
} else {
(filterAgg as LongValueAggResult).value
}
FacetExpressionValue(
facetFilterExpr.name,
selectedNames.contains(facetFilterExpr.name),
Expand All @@ -92,7 +94,7 @@ open class FacetExpressionsFilter(
) : Filter<FacetExpressionFilterResult>(name) {

override fun prepare(name: String, paramName: String, params: QueryFilterParams): PreparedFacetExpressionFilter {
val filterValues = params.getOrElse(listOf(paramName)) { emptyList() }
val filterValues = params.getOrDefault(listOf(paramName), emptyList())

val selectedValues = filterValues.mapNotNull { value ->
allValues.find { it.name == value }
Expand Down

0 comments on commit c17ecf9

Please sign in to comment.