Hi all

I use DocValue for scoring function. I.e. I have some column with integers,
that are used in scoring formula. So I have a scorer that calculates
scoring function twice:
- in score()
- in explain()

I got the following error in explain:

Caused by: java.lang.IndexOutOfBoundsException
        at java.nio.Buffer.checkIndex(Buffer.java:540) ~[?:1.8.0_161]
        at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:253)
~[?:1.8.0_161]
        at
org.apache.lucene.store.ByteBufferGuard.getByte(ByteBufferGuard.java:118)
~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 -
ubuntu - 2017-10-13 16:12:42]
        at
org.apache.lucene.store.ByteBufferIndexInput$SingleBufferImpl.readByte(ByteBufferIndexInput.java:385)
~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 -
ubuntu - 2017-10-13 16:12:42]
        at
org.apache.lucene.util.packed.DirectReader$DirectPackedReader8.get(DirectReader.java:145)
~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 -
ubuntu - 2017-10-13 16:12:42]
        at
org.apache.lucene.codecs.lucene70.Lucene70DocValuesProducer$3.longValue(Lucene70DocValuesProducer.java:481)
~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 -
ubuntu - 2017-10-13 16:12:42]
        at
org.apache.lucene.index.SingletonSortedNumericDocValues.nextValue(SingletonSortedNumericDocValues.java:73)
~[lucene-core-7.1.0.jar:7.1.0 84c90ad2c0218156c840e19a64d72b8a38550659 -
ubuntu - 2017-10-13 16:12:42]

I've found the following comment in the source code of
SortedNumericDocValues.java:

/**
 * Iterates to the next value in the current document.  Do not call
this more than {@link #docValueCount} times
 * for the document.
 */

public abstract long nextValue() throws IOException;


Questions:
1) Why I can't read the values twice?
2) How can I manage this situation?
3) Can it work for NumericDocValues?

Regards,
Vadim Gindin

Reply via email to