Skip to content

Commit

Permalink
Avoid deprecated DenseVectorField apply method
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippus committed Jul 15, 2024
1 parent 45e748d commit 4189aff
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ class DenseVectorFieldTest extends AnyFlatSpec with Matchers with ElasticApi {
private val denseVectorIndexOptions = DenseVectorIndexOptions(Int8Hnsw, Some(10), Some(100), Some(1.0f))

"A DenseVectorField" should "support dims property" in {
val field = DenseVectorField(name = "myfield", dims = 3)
val field = DenseVectorField(name = "myfield").dims(3)
DenseVectorFieldBuilderFn.build(field).string shouldBe
"""{"type":"dense_vector","dims":3,"index":false}"""
}

it should "support all similarity options" in {
val field = DenseVectorField(name = "myfield", dims = 3, index = true, similarity = L2Norm)
val field = DenseVectorField(name = "myfield").dims(3).index(true).similarity(L2Norm)
DenseVectorFieldBuilderFn.build(field).string shouldBe
"""{"type":"dense_vector","dims":3,"index":true,"similarity":"l2_norm"}"""
DenseVectorFieldBuilderFn.build(field.similarity(DotProduct)).string shouldBe
Expand All @@ -29,7 +29,7 @@ class DenseVectorFieldTest extends AnyFlatSpec with Matchers with ElasticApi {
}

it should "support elementType property" in {
val field = DenseVectorField(name = "myfield", dims = 3).elementType("byte")
val field = DenseVectorField(name = "myfield").dims(3).elementType("byte")
DenseVectorFieldBuilderFn.build(field).string shouldBe
"""{"type":"dense_vector","element_type":"byte","dims":3,"index":false}"""
}
Expand Down

0 comments on commit 4189aff

Please sign in to comment.