diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-10-11 10:20:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-11 10:20:39 +0200 |
commit | 569e881fddd07b86878f18b49bac77b8118d04cc (patch) | |
tree | 0e4a8e7ac71808b372aeb4b7809d1eb8bdf199e8 /container-search | |
parent | 9acd6b680d7b55f22a0df1cf3fd350b2dab8a3a8 (diff) | |
parent | 193cacbb78224af1da02f2c3de3b8cc2d1f3bad6 (diff) |
Merge pull request #10954 from vespa-engine/bratseth/string-bucket-convenience-constructor
Bratseth/string bucket convenience constructor
Diffstat (limited to 'container-search')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/grouping/request/StringBucket.java | 29 |
1 files changed, 17 insertions, 12 deletions
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 5558f1443db..c0bea7003c0 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 @@ -8,31 +8,36 @@ package com.yahoo.search.grouping.request; */ public class StringBucket extends BucketValue { - /** - * Get the next distinct value. - * - * @param value The base value. - * @return the next value. - */ + /** Returns the next distinct value after the given value */ public static StringValue nextValue(StringValue value) { return new StringValue(value.getValue() + " "); } + /** Constructs a new bucket for a single unique string */ + public StringBucket(String value) { + this(new StringValue(value)); + } + + /** Constructs a new bucket for a single unique string */ + public StringBucket(StringValue value) { + this(value, nextValue(value)); + } + /** - * Constructs a new instance of this class. + * Constructs a new bucket for a range of strings. * - * @param from The from-value to assign to this. - * @param to The to-value to assign to this. + * @param from the start of the bucket, inclusive + * @param to the end of the bucket, exclusive */ public StringBucket(String from, String to) { super(null, null, new StringValue(from), new StringValue(to)); } /** - * Constructs a new instance of this class. + * Constructs a new bucket for a range of strings. * - * @param from The from-value to assign to this. - * @param to The to-value to assign to this. + * @param from the start of the bucket, inclusive + * @param to the end of the bucket, exclusive */ public StringBucket(ConstantValue<?> from, ConstantValue<?> to) { super(null, null, from, to); |