iverase commented on issue #12459: URL: https://github.com/apache/lucene/issues/12459#issuecomment-1650744812
I expect that the use case of wrapping the byte[] from a binary doc values with a `ByteArrayDataInput` to read the contents to be common, so this approach will give that in a more efficient way. I think we should provide the possibility to be able to have random access so I would like to refine my original proposal by adding a DataInputDocValue which is just a DataInput which is positional aware. The API would look like: ``` public abstract class DataInputDocValues extends DocValuesIterator { /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */ protected DataInputDocValues() {} /** * Returns the binary value wrapped as a {@link DataInputDocValue} for the current document ID. It * is illegal to call this method after {@link #advanceExact(int)} returned {@code false}. * * @return the binary value wrapped as a {@link DataInputDocValue} */ public abstract DataInputDocValue dataInputValue() throws IOException; /** * A {@link DataInput} view over a binary doc value which is positional aware. * * @lucene.experimental */ public abstract static class DataInputDocValue extends DataInput { /** Sets the position in this stream. */ public abstract void setPosition(int pos) throws IOException; /** Returns the current position in this stream. */ public abstract int getPosition() throws IOException; } } ``` I updated the prototype accordingly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org