Skip to content

Commit

Permalink
Fix mr
Browse files Browse the repository at this point in the history
  • Loading branch information
a.usenko committed Jan 17, 2024
1 parent b54baa4 commit ad701d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
22 changes: 11 additions & 11 deletions elasticmagic-query-filters/api/elasticmagic-query-filters.api
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init> (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 <init> (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;
Expand All @@ -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 <init> (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 <init> ()V
public fun <init> (Ljava/lang/String;Ljava/util/List;Ldev/evo/elasticmagic/qf/FilterMode;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<FaceExpressionValue>,
val results: List<FacetExpressionValue>,
val mode: FilterMode
) : FilterResult

Expand Down Expand Up @@ -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
Expand All @@ -92,13 +92,7 @@ open class FacetExpressionsFilter(
) : Filter<FacetExpressionFilterResult>(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 }
Expand Down

0 comments on commit ad701d4

Please sign in to comment.