Skip to content

Commit

Permalink
Spotless apply
Browse files Browse the repository at this point in the history
Signed-off-by: Finn Carroll <[email protected]>
  • Loading branch information
finnegancarroll committed Aug 28, 2024
1 parent b7e06f3 commit 4e8bc03
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<SearchHitsProtobuf> {

@Override
Expand All @@ -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()));
}

Expand Down

0 comments on commit 4e8bc03

Please sign in to comment.