From 8f610691c6b235566c89f048dda3f24411cdb556 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Mon, 14 Oct 2019 11:18:18 +0200 Subject: Add constructor for controlling end value include/exclude --- .../com/yahoo/search/grouping/request/StringBucket.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'container-search/src/main/java/com/yahoo/search/grouping') diff --git a/container-search/src/main/java/com/yahoo/search/grouping/request/StringBucket.java b/container-search/src/main/java/com/yahoo/search/grouping/request/StringBucket.java index c0bea7003c0..12374fbc60d 100644 --- a/container-search/src/main/java/com/yahoo/search/grouping/request/StringBucket.java +++ b/container-search/src/main/java/com/yahoo/search/grouping/request/StringBucket.java @@ -30,7 +30,21 @@ public class StringBucket extends BucketValue { * @param to the end of the bucket, exclusive */ public StringBucket(String from, String to) { - super(null, null, new StringValue(from), new StringValue(to)); + this(from, to, false); + } + + /** + * Constructs a new bucket for a range of strings. + * + * @param from the start of the bucket, inclusive + * @param to the end of the bucket + * @param toInclusive whether to value should be included in the bucket + */ + public StringBucket(String from, String to, boolean toInclusive) { + super(null, + null, + new StringValue(from), + toInclusive ? nextValue(new StringValue(to)) : new StringValue(to)); } /** -- cgit v1.2.3