From 01653f8b384e44635d31adcfcec0159fe594c566 Mon Sep 17 00:00:00 2001 From: jurgisnosto <102148398+jurgisnosto@users.noreply.github.com> Date: Wed, 25 Sep 2024 21:30:55 +0300 Subject: [PATCH] Rank feature query function typing fixes (#3160) * fix: rank feature function typings * fix: failing tests --- .../searches/queries/RankFeatureQueryBodyFnTest.scala | 6 +++--- .../requests/searches/queries/RankFeatureQuery.scala | 6 +++--- .../src/test/resources/json/search/search_rank_feature.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/queries/RankFeatureQueryBodyFnTest.scala b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/queries/RankFeatureQueryBodyFnTest.scala index 0dccbe6e1..9774ce6a5 100644 --- a/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/queries/RankFeatureQueryBodyFnTest.scala +++ b/elastic4s-core/src/test/scala/com/sksamuel/elastic4s/requests/searches/queries/RankFeatureQueryBodyFnTest.scala @@ -25,7 +25,7 @@ class RankFeatureQueryBodyFnTest extends AnyFunSuite with Matchers with GivenWhe | "field": "pagerank", | "boost": 0.5, | "sigmoid": { - | "pivot": 7, + | "pivot": 7.0, | "exponent": 0.6 | } | } @@ -50,7 +50,7 @@ class RankFeatureQueryBodyFnTest extends AnyFunSuite with Matchers with GivenWhe | "rank_feature":{ | "field": "pagerank", | "log": { - | "scaling_factor": 3 + | "scaling_factor": 3.0 | } | } |} @@ -75,7 +75,7 @@ class RankFeatureQueryBodyFnTest extends AnyFunSuite with Matchers with GivenWhe | "rank_feature":{ | "field": "pagerank", | "saturation": { - | "pivot": 2 + | "pivot": 2.0 | } | } |} diff --git a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/queries/RankFeatureQuery.scala b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/queries/RankFeatureQuery.scala index 5fd1988c3..ffbb184b1 100644 --- a/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/queries/RankFeatureQuery.scala +++ b/elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/searches/queries/RankFeatureQuery.scala @@ -26,8 +26,8 @@ case class RankFeatureQuery(field: String, } object RankFeatureQuery { - case class Saturation(pivot: Option[Int]) - case class Log(scalingFactor: Int) - case class Sigmoid(pivot: Int, exponent: Double) + case class Saturation(pivot: Option[Float]) + case class Log(scalingFactor: Float) + case class Sigmoid(pivot: Float, exponent: Double) case class Linear() } diff --git a/elastic4s-tests/src/test/resources/json/search/search_rank_feature.json b/elastic4s-tests/src/test/resources/json/search/search_rank_feature.json index a954b0300..2dce7156c 100644 --- a/elastic4s-tests/src/test/resources/json/search/search_rank_feature.json +++ b/elastic4s-tests/src/test/resources/json/search/search_rank_feature.json @@ -5,7 +5,7 @@ "field": "pagerank", "boost": 0.5, "sigmoid": { - "pivot": 7, + "pivot": 7.0, "exponent": 0.6 } }