diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/grouping/result')
4 files changed, 11 insertions, 27 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/grouping/result/BucketGroupId.java b/container-search/src/main/java/com/yahoo/search/grouping/result/BucketGroupId.java index 05efc134465..0bea390ad63 100644 --- a/container-search/src/main/java/com/yahoo/search/grouping/result/BucketGroupId.java +++ b/container-search/src/main/java/com/yahoo/search/grouping/result/BucketGroupId.java @@ -1,8 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.grouping.result; -import static com.yahoo.text.Lowercase.toLowerCase; - /** * This abstract class is used in {@link Group} instances where the identifying expression evaluated to a {@link * com.yahoo.search.grouping.request.BucketValue}. The range is inclusive-from and exclusive-to. diff --git a/container-search/src/main/java/com/yahoo/search/grouping/result/HitRenderer.java b/container-search/src/main/java/com/yahoo/search/grouping/result/HitRenderer.java index 343fea82b6e..91c46960ab0 100644 --- a/container-search/src/main/java/com/yahoo/search/grouping/result/HitRenderer.java +++ b/container-search/src/main/java/com/yahoo/search/grouping/result/HitRenderer.java @@ -7,7 +7,6 @@ import com.yahoo.text.Utf8String; import com.yahoo.text.XMLWriter; import java.io.IOException; -import java.util.Arrays; import java.util.Map; /** @@ -63,28 +62,15 @@ public abstract class HitRenderer { private static void renderGroupId(GroupId id, XMLWriter writer) { writer.openTag(TAG_GROUP_ID).attribute(ATR_TYPE, id.getTypeName()); - if (id instanceof ValueGroupId) { - writer.content(getIdValue((ValueGroupId)id), false); - } else if (id instanceof BucketGroupId) { - BucketGroupId bucketId = (BucketGroupId)id; - writer.openTag(TAG_BUCKET_FROM).content(getBucketFrom(bucketId), false).closeTag(); - writer.openTag(TAG_BUCKET_TO).content(getBucketTo(bucketId), false).closeTag(); + if (id instanceof ValueGroupId<?> valueGroupId) { + writer.content(valueGroupId.getValue(), false); + } else if (id instanceof BucketGroupId bucketId) { + writer.openTag(TAG_BUCKET_FROM).content(bucketId.getFrom(), false).closeTag(); + writer.openTag(TAG_BUCKET_TO).content(bucketId.getTo(), false).closeTag(); } writer.closeTag(); } - private static Object getIdValue(ValueGroupId id) { - return id instanceof RawId ? Arrays.toString(((RawId)id).getValue()) : id.getValue(); - } - - private static Object getBucketFrom(BucketGroupId id) { - return id instanceof RawBucketId ? Arrays.toString(((RawBucketId)id).getFrom()) : id.getFrom(); - } - - private static Object getBucketTo(BucketGroupId id) { - return id instanceof RawBucketId ? Arrays.toString(((RawBucketId)id).getTo()) : id.getTo(); - } - private static void renderContinuations(Map<String, Continuation> continuations, XMLWriter writer) { for (Map.Entry<String, Continuation> entry : continuations.entrySet()) { renderContinuation(entry.getKey(), entry.getValue(), writer); diff --git a/container-search/src/main/java/com/yahoo/search/grouping/result/RawBucketId.java b/container-search/src/main/java/com/yahoo/search/grouping/result/RawBucketId.java index 9576f548f4a..9b5ad6660b0 100644 --- a/container-search/src/main/java/com/yahoo/search/grouping/result/RawBucketId.java +++ b/container-search/src/main/java/com/yahoo/search/grouping/result/RawBucketId.java @@ -1,7 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.grouping.result; -import java.util.Arrays; +import com.yahoo.prelude.hitfield.RawBase64; /** * This class is used in {@link Group} instances where the identifying @@ -9,7 +9,7 @@ import java.util.Arrays; * * @author Ulf Lilleengen */ -public class RawBucketId extends BucketGroupId<byte[]> { +public class RawBucketId extends BucketGroupId<RawBase64> { /** * Constructs a new instance of this class. @@ -18,6 +18,6 @@ public class RawBucketId extends BucketGroupId<byte[]> { * @param to The identifying exclusive-to raw buffer. */ public RawBucketId(byte[] from, byte[] to) { - super("raw_bucket", from, Arrays.toString(from), to, Arrays.toString(to)); + super("raw_bucket", new RawBase64(from), new RawBase64(to)); } } diff --git a/container-search/src/main/java/com/yahoo/search/grouping/result/RawId.java b/container-search/src/main/java/com/yahoo/search/grouping/result/RawId.java index de711d0c218..fd0d38c37fd 100644 --- a/container-search/src/main/java/com/yahoo/search/grouping/result/RawId.java +++ b/container-search/src/main/java/com/yahoo/search/grouping/result/RawId.java @@ -1,14 +1,14 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.grouping.result; -import java.util.Arrays; +import com.yahoo.prelude.hitfield.RawBase64; /** * This class is used in {@link Group} instances where the identifying expression evaluated to a {@link Byte} array. * * @author Simon Thoresen Hult */ -public class RawId extends ValueGroupId<byte[]> { +public class RawId extends ValueGroupId<RawBase64> { /** * Constructs a new instance of this class. @@ -16,6 +16,6 @@ public class RawId extends ValueGroupId<byte[]> { * @param value The identifying byte array. */ public RawId(byte[] value) { - super("raw", value, Arrays.toString(value)); + super("raw", new RawBase64(value)); } } |