diff options
Diffstat (limited to 'core/src/main/java/org/elasticsearch/index/fielddata/SortedBinaryDocValues.java')
-rw-r--r-- | core/src/main/java/org/elasticsearch/index/fielddata/SortedBinaryDocValues.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/core/src/main/java/org/elasticsearch/index/fielddata/SortedBinaryDocValues.java b/core/src/main/java/org/elasticsearch/index/fielddata/SortedBinaryDocValues.java index b3c51141e2..119fda1bda 100644 --- a/core/src/main/java/org/elasticsearch/index/fielddata/SortedBinaryDocValues.java +++ b/core/src/main/java/org/elasticsearch/index/fielddata/SortedBinaryDocValues.java @@ -21,28 +21,35 @@ package org.elasticsearch.index.fielddata; import org.apache.lucene.util.BytesRef; +import java.io.IOException; + /** * A list of per-document binary values, sorted * according to {@link BytesRef#compareTo(BytesRef)}. * There might be dups however. */ +// TODO: Should it expose a count (current approach) or return null when there are no more values? public abstract class SortedBinaryDocValues { /** - * Positions to the specified document + * Advance this instance to the given document id + * @return true if there is a value for this document */ - public abstract void setDocument(int docId); + public abstract boolean advanceExact(int doc) throws IOException; - /** - * Return the number of values of the current document. + /** + * Retrieves the number of values for the current document. This must always + * be greater than zero. + * It is illegal to call this method after {@link #advanceExact(int)} + * returned {@code false}. */ - public abstract int count(); + public abstract int docValueCount(); - /** - * Retrieve the value for the current document at the specified index. - * An index ranges from {@code 0} to {@code count()-1}. + /** + * Iterates to the next value in the current document. Do not call this more than + * {@link #docValueCount} times for the document. * Note that the returned {@link BytesRef} might be reused across invocations. */ - public abstract BytesRef valueAt(int index); + public abstract BytesRef nextValue() throws IOException; } |