From 50889eb4ace4d1296f7df13bf6216c0c89957b04 Mon Sep 17 00:00:00 2001 From: Kirill Ostanin Date: Mon, 23 Oct 2023 11:54:23 +0400 Subject: [PATCH] fix spotless Signed-off-by: Kirill Ostanin --- .../_types/query_dsl/NeuralQuery.java | 11 +++--- .../client/opensearch/model/VariantsTest.java | 34 ++++++++----------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java index 60952db0f0..e1041db04e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java @@ -9,6 +9,8 @@ package org.opensearch.client.opensearch._types.query_dsl; import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -17,9 +19,6 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; -import javax.annotation.Nullable; -import java.util.function.Function; - @JsonpDeserializable public class NeuralQuery extends QueryBase implements QueryVariant { @@ -29,7 +28,6 @@ public class NeuralQuery extends QueryBase implements QueryVariant { @Nullable private final String modelId; - private NeuralQuery(NeuralQuery.Builder builder) { super(builder); @@ -189,8 +187,8 @@ public NeuralQuery build() { } public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - NeuralQuery.Builder::new, - NeuralQuery::setupNeuralQueryDeserializer + NeuralQuery.Builder::new, + NeuralQuery::setupNeuralQueryDeserializer ); protected static void setupNeuralQueryDeserializer(ObjectDeserializer op) { @@ -200,7 +198,6 @@ protected static void setupNeuralQueryDeserializer(ObjectDeserializer s.query( - q -> q.neural(n -> n.field("passage_embedding") - .queryText("Hi world") - .modelId("bQ1J8ooBpBj3wT4HVUsb") - .k(100) - ) - ) + s -> s.query(q -> q.neural(n -> n.field("passage_embedding").queryText("Hi world").modelId("bQ1J8ooBpBj3wT4HVUsb").k(100))) ); assertEquals("passage_embedding", searchRequest.query().neural().field()); @@ -228,19 +222,19 @@ public void testNeuralQuery() { @Test public void testNeuralQueryFromJson() { - String json = "{\n" + - " \"from\": 0,\n" + - " \"size\": 100,\n" + - " \"query\": {\n" + - " \"neural\": {\n" + - " \"passage_embedding\": {\n" + - " \"query_text\": \"Hi world\",\n" + - " \"model_id\": \"bQ1J8ooBpBj3wT4HVUsb\",\n" + - " \"k\": 100\n" + - " }\n" + - " }\n" + - " }\n" + - "}"; + String json = "{\n" + + " \"from\": 0,\n" + + " \"size\": 100,\n" + + " \"query\": {\n" + + " \"neural\": {\n" + + " \"passage_embedding\": {\n" + + " \"query_text\": \"Hi world\",\n" + + " \"model_id\": \"bQ1J8ooBpBj3wT4HVUsb\",\n" + + " \"k\": 100\n" + + " }\n" + + " }\n" + + " }\n" + + "}"; SearchRequest searchRequest = ModelTestCase.fromJson(json, SearchRequest.class, mapper);