mirror of https://github.com/apache/lucene.git
LUCENE-3170: Fixed wrong in-memory ValuesEnum on BYTES_VAR_STRAIGHT type
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/docvalues@1131367 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
79e8ecb73f
commit
fa5b875281
|
@ -146,6 +146,20 @@ class VarStraightBytesImpl {
|
|||
: (int) (addresses.get(1 + docID) - address);
|
||||
return data.fillSlice(bytesRef, address, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValuesEnum getEnum(AttributeSource attrSource) throws IOException {
|
||||
return new SourceEnum(attrSource, type(), this, maxDoc()) {
|
||||
@Override
|
||||
public int advance(int target) throws IOException {
|
||||
if (target >= numDocs) {
|
||||
return pos = NO_MORE_DOCS;
|
||||
}
|
||||
source.getBytes(target, bytesRef);
|
||||
return pos = target;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValueCount() {
|
||||
|
|
|
@ -207,6 +207,13 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
|||
case INTS:
|
||||
assertEquals(msg, valuesPerIndex-1, vE_2_merged.advance(valuesPerIndex-1));
|
||||
}
|
||||
// switch (first) { // these variants don't advance over missing values
|
||||
// case BYTES_FIXED_STRAIGHT:
|
||||
// case FLOAT_32:
|
||||
// case FLOAT_64:
|
||||
// case INTS:
|
||||
// assertEquals(msg, valuesPerIndex-1, vE_1_merged.advance(valuesPerIndex-1));
|
||||
// }
|
||||
|
||||
for (int i = 0; i < valuesPerIndex; i++) {
|
||||
assertEquals(msg, i, vE_1.nextDoc());
|
||||
|
@ -385,17 +392,9 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
|||
assertEquals(0, br.length);
|
||||
// make sure we advance at least until base
|
||||
ValuesEnum bytesEnum = getValuesEnum(bytesReader);
|
||||
try {
|
||||
|
||||
final int advancedTo = bytesEnum.advance(0);
|
||||
assertTrue(byteIndexValue.name() + " advanced failed base:" + base
|
||||
+ " advancedTo: " + advancedTo, base <= advancedTo);
|
||||
}catch(Throwable e) {
|
||||
final int advancedTo = bytesEnum.advance(0);
|
||||
assertTrue(byteIndexValue.name() + " advanced failed base:" + base
|
||||
+ " advancedTo: " + advancedTo, base <= advancedTo);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue