diff --git a/server/src/main/java/org/opensearch/transport/protobuf/ProtoSerDeHelpers.java b/server/src/main/java/org/opensearch/transport/protobuf/ProtoSerDeHelpers.java index b8880f5b66f34..dd2db1320924d 100644 --- a/server/src/main/java/org/opensearch/transport/protobuf/ProtoSerDeHelpers.java +++ b/server/src/main/java/org/opensearch/transport/protobuf/ProtoSerDeHelpers.java @@ -12,11 +12,9 @@ import org.apache.lucene.search.Explanation; import org.opensearch.common.document.DocumentField; import org.opensearch.common.io.stream.BytesStreamOutput; -import org.opensearch.common.lucene.Lucene; import org.opensearch.core.common.bytes.BytesArray; import org.opensearch.core.common.bytes.BytesReference; import org.opensearch.core.common.io.stream.StreamInput; -import org.opensearch.core.common.io.stream.StreamOutput; import org.opensearch.core.common.text.Text; import org.opensearch.core.index.Index; import org.opensearch.core.index.shard.ShardId; @@ -34,7 +32,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; -import java.util.List; import static org.opensearch.common.lucene.Lucene.readSortValue; import static org.opensearch.common.lucene.Lucene.writeSortValue; @@ -151,9 +148,7 @@ public static DocumentField documentFieldFromProto(DocumentFieldProto proto) thr } public static HighlightFieldProto highlightFieldToProto(HighlightField field) { - HighlightFieldProto.Builder builder = HighlightFieldProto.newBuilder() - .setName(field.getName()) - .setFragsNull(true); + HighlightFieldProto.Builder builder = HighlightFieldProto.newBuilder().setName(field.getName()).setFragsNull(true); if (field.getFragments() != null) { builder.setFragsNull(false); diff --git a/server/src/main/java/org/opensearch/transport/protobuf/SearchHitProtobuf.java b/server/src/main/java/org/opensearch/transport/protobuf/SearchHitProtobuf.java index 5cd219f0d48de..69ee7e3ef1237 100644 --- a/server/src/main/java/org/opensearch/transport/protobuf/SearchHitProtobuf.java +++ b/server/src/main/java/org/opensearch/transport/protobuf/SearchHitProtobuf.java @@ -47,7 +47,9 @@ public SearchHitProtobuf(StreamInput in) throws IOException { fromProtobufStream(in); } - public SearchHitProtobuf(SearchHitProto proto) { fromProto(proto); } + public SearchHitProtobuf(SearchHitProto proto) { + fromProto(proto); + } @Override public void writeTo(StreamOutput out) throws IOException { diff --git a/server/src/main/java/org/opensearch/transport/protobuf/SearchHitsProtobuf.java b/server/src/main/java/org/opensearch/transport/protobuf/SearchHitsProtobuf.java index d677c1de62eb4..b46181f3e55b4 100644 --- a/server/src/main/java/org/opensearch/transport/protobuf/SearchHitsProtobuf.java +++ b/server/src/main/java/org/opensearch/transport/protobuf/SearchHitsProtobuf.java @@ -62,7 +62,9 @@ SearchHitsProto toProto() { } if (totalHits != null) { - TotalHitsProto.Builder totHitsBuilder = TotalHitsProto.newBuilder().setRelation(totalHits.relation.ordinal()).setValue(totalHits.value); + TotalHitsProto.Builder totHitsBuilder = TotalHitsProto.newBuilder() + .setRelation(totalHits.relation.ordinal()) + .setValue(totalHits.value); builder.setTotalHits(totHitsBuilder); } diff --git a/server/src/test/java/org/opensearch/search/SearchHitsProtobufTests.java b/server/src/test/java/org/opensearch/search/SearchHitsProtobufTests.java index 02801a24a6126..14b84069c555a 100644 --- a/server/src/test/java/org/opensearch/search/SearchHitsProtobufTests.java +++ b/server/src/test/java/org/opensearch/search/SearchHitsProtobufTests.java @@ -35,27 +35,13 @@ import org.apache.lucene.search.SortField; import org.apache.lucene.search.TotalHits; import org.apache.lucene.tests.util.TestUtil; -import org.opensearch.action.OriginalIndices; import org.opensearch.common.lucene.LuceneTests; -import org.opensearch.common.xcontent.LoggingDeprecationHandler; import org.opensearch.common.xcontent.XContentType; -import org.opensearch.common.xcontent.json.JsonXContent; -import org.opensearch.core.common.bytes.BytesReference; import org.opensearch.core.common.io.stream.Writeable; -import org.opensearch.core.index.Index; -import org.opensearch.core.index.shard.ShardId; import org.opensearch.core.xcontent.MediaType; -import org.opensearch.core.xcontent.ToXContent; -import org.opensearch.core.xcontent.XContentBuilder; -import org.opensearch.core.xcontent.XContentParser; -import org.opensearch.test.AbstractSerializingTestCase; import org.opensearch.test.AbstractWireSerializingTestCase; import org.opensearch.transport.protobuf.SearchHitsProtobuf; -import java.io.IOException; -import java.util.Collections; -import java.util.function.Predicate; - public class SearchHitsProtobufTests extends AbstractWireSerializingTestCase { @Override @@ -75,7 +61,11 @@ public static SearchHitsProtobuf createTestItem(boolean withOptionalInnerHits, b return createTestItem(randomFrom(XContentType.values()), withOptionalInnerHits, withShardTarget); } - public static SearchHitsProtobuf createTestItem(final MediaType mediaType, boolean withOptionalInnerHits, boolean transportSerialization) { + public static SearchHitsProtobuf createTestItem( + final MediaType mediaType, + boolean withOptionalInnerHits, + boolean transportSerialization + ) { return createTestItem(mediaType, withOptionalInnerHits, transportSerialization, randomFrom(TotalHits.Relation.values())); }