From ad701d486fa91c2d70ad2ba1de79f6f13e054305 Mon Sep 17 00:00:00 2001 From: "a.usenko" Date: Wed, 17 Jan 2024 14:44:34 +0200 Subject: [PATCH] Fix mr --- .../api/elasticmagic-query-filters.api | 22 +++++++++---------- .../elasticmagic/qf/FacetExpressionsFilter.kt | 14 ++++-------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/elasticmagic-query-filters/api/elasticmagic-query-filters.api b/elasticmagic-query-filters/api/elasticmagic-query-filters.api index 17b6acb505..65caacbf2c 100644 --- a/elasticmagic-query-filters/api/elasticmagic-query-filters.api +++ b/elasticmagic-query-filters/api/elasticmagic-query-filters.api @@ -295,13 +295,21 @@ public final class dev/evo/elasticmagic/qf/ExpressionValue { public final fun getName ()Ljava/lang/String; } -public final class dev/evo/elasticmagic/qf/FaceExpressionValue { +public final class dev/evo/elasticmagic/qf/FacetExpressionFilterResult : dev/evo/elasticmagic/qf/FilterResult { + public fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ldev/evo/elasticmagic/qf/FilterMode;)V + public final fun getMode ()Ldev/evo/elasticmagic/qf/FilterMode; + public fun getName ()Ljava/lang/String; + public fun getParamName ()Ljava/lang/String; + public final fun getResults ()Ljava/util/List; +} + +public final class dev/evo/elasticmagic/qf/FacetExpressionValue { public fun (Ljava/lang/String;ZJ)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Z public final fun component3 ()J - public final fun copy (Ljava/lang/String;ZJ)Ldev/evo/elasticmagic/qf/FaceExpressionValue; - public static synthetic fun copy$default (Ldev/evo/elasticmagic/qf/FaceExpressionValue;Ljava/lang/String;ZJILjava/lang/Object;)Ldev/evo/elasticmagic/qf/FaceExpressionValue; + public final fun copy (Ljava/lang/String;ZJ)Ldev/evo/elasticmagic/qf/FacetExpressionValue; + public static synthetic fun copy$default (Ldev/evo/elasticmagic/qf/FacetExpressionValue;Ljava/lang/String;ZJILjava/lang/Object;)Ldev/evo/elasticmagic/qf/FacetExpressionValue; public fun equals (Ljava/lang/Object;)Z public final fun getDocCount ()J public final fun getName ()Ljava/lang/String; @@ -310,14 +318,6 @@ public final class dev/evo/elasticmagic/qf/FaceExpressionValue { public fun toString ()Ljava/lang/String; } -public final class dev/evo/elasticmagic/qf/FacetExpressionFilterResult : dev/evo/elasticmagic/qf/FilterResult { - public fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ldev/evo/elasticmagic/qf/FilterMode;)V - public final fun getMode ()Ldev/evo/elasticmagic/qf/FilterMode; - public fun getName ()Ljava/lang/String; - public fun getParamName ()Ljava/lang/String; - public final fun getResults ()Ljava/util/List; -} - public class dev/evo/elasticmagic/qf/FacetExpressionsFilter : dev/evo/elasticmagic/qf/Filter { public fun ()V public fun (Ljava/lang/String;Ljava/util/List;Ldev/evo/elasticmagic/qf/FilterMode;)V diff --git a/elasticmagic-query-filters/src/commonMain/kotlin/dev/evo/elasticmagic/qf/FacetExpressionsFilter.kt b/elasticmagic-query-filters/src/commonMain/kotlin/dev/evo/elasticmagic/qf/FacetExpressionsFilter.kt index c983a0d9ab..97ee62f56c 100644 --- a/elasticmagic-query-filters/src/commonMain/kotlin/dev/evo/elasticmagic/qf/FacetExpressionsFilter.kt +++ b/elasticmagic-query-filters/src/commonMain/kotlin/dev/evo/elasticmagic/qf/FacetExpressionsFilter.kt @@ -8,12 +8,12 @@ import dev.evo.elasticmagic.aggs.SingleBucketAggResult import dev.evo.elasticmagic.query.Bool import dev.evo.elasticmagic.query.QueryExpression -data class FaceExpressionValue(val name: String, val selected: Boolean, val docCount: Long) +data class FacetExpressionValue(val name: String, val selected: Boolean, val docCount: Long) class FacetExpressionFilterResult( override val name: String, override val paramName: String, - val results: List, + val results: List, val mode: FilterMode ) : FilterResult @@ -74,7 +74,7 @@ class PreparedFacetExpressionFilter( val docCount = if (filterAgg is SingleBucketAggResult) filterAgg.docCount else (filterAgg as LongValueAggResult).value - FaceExpressionValue( + FacetExpressionValue( facetFilterExpr.name, selectedNames.contains(facetFilterExpr.name), docCount @@ -92,13 +92,7 @@ open class FacetExpressionsFilter( ) : Filter(name) { override fun prepare(name: String, paramName: String, params: QueryFilterParams): PreparedFacetExpressionFilter { - val filterValues = params.getOrElse(listOf(paramName)) { null } ?: return PreparedFacetExpressionFilter( - name, - paramName, - emptyList(), - allValues, - mode - ) + val filterValues = params.getOrElse(listOf(paramName)) { emptyList() } val selectedValues = filterValues.mapNotNull { value -> allValues.find { it.name == value }