public abstract class DocValuesArraySource extends DocValues.Source
DocValues.Source
implementation backed by
simple arrays.Modifier and Type | Field and Description |
---|---|
protected int |
bytesPerValue
Number of bytes to encode each doc value.
|
type
Modifier and Type | Method and Description |
---|---|
static int |
asInt(BytesRef b)
Converts 4 consecutive bytes from the current offset to an int.
|
static long |
asLong(BytesRef b)
Converts 8 consecutive bytes from the current offset to a long.
|
static short |
asShort(BytesRef b)
Converts 2 consecutive bytes from the current offset to a short.
|
static void |
copyInt(BytesRef ref,
int value)
Copies the given int value and encodes it as 4 byte Big-Endian.
|
static void |
copyLong(BytesRef ref,
long value)
Copies the given long value and encodes it as 8 byte Big-Endian.
|
static void |
copyShort(BytesRef ref,
short value)
Copies the given short value and encodes it as a 2 byte Big-Endian.
|
static DocValuesArraySource |
forType(DocValues.Type type)
Returns the
DocValuesArraySource for the given
DocValues.Type . |
abstract BytesRef |
getBytes(int docID,
BytesRef ref)
Returns a
BytesRef for the given document id or throws an
UnsupportedOperationException if this source doesn't support
byte[] values. |
boolean |
hasArray()
Returns
true iff this DocValues.Source exposes an array via
DocValues.Source.getArray() otherwise false . |
abstract DocValuesArraySource |
newFromArray(Object array)
Creates
DocValuesArraySource from a native
array. |
abstract DocValuesArraySource |
newFromInput(IndexInput input,
int numDocs)
Creates a
DocValuesArraySource by loading a
previously saved one from an IndexInput . |
void |
toBytes(double value,
BytesRef bytesRef)
Encode a double value into the provided
BytesRef . |
void |
toBytes(long value,
BytesRef bytesRef)
Encode a long value into the provided
BytesRef . |
asSortedSource, getArray, getFloat, getInt, getType
protected final int bytesPerValue
public static DocValuesArraySource forType(DocValues.Type type)
DocValuesArraySource
for the given
DocValues.Type
.public abstract BytesRef getBytes(int docID, BytesRef ref)
DocValues.Source
BytesRef
for the given document id or throws an
UnsupportedOperationException
if this source doesn't support
byte[] values.getBytes
in class DocValues.Source
public abstract DocValuesArraySource newFromInput(IndexInput input, int numDocs) throws IOException
DocValuesArraySource
by loading a
previously saved one from an IndexInput
.IOException
public abstract DocValuesArraySource newFromArray(Object array)
DocValuesArraySource
from a native
array.public final boolean hasArray()
DocValues.Source
true
iff this DocValues.Source
exposes an array via
DocValues.Source.getArray()
otherwise false
.hasArray
in class DocValues.Source
true
iff this DocValues.Source
exposes an array via
DocValues.Source.getArray()
otherwise false
.public void toBytes(long value, BytesRef bytesRef)
BytesRef
.public void toBytes(double value, BytesRef bytesRef)
BytesRef
.public static void copyLong(BytesRef ref, long value)
NOTE: this method resets the offset to 0, length to 8 and resizes the reference array if needed.
public static void copyInt(BytesRef ref, int value)
NOTE: this method resets the offset to 0, length to 4 and resizes the reference array if needed.
public static void copyShort(BytesRef ref, short value)
NOTE: this method resets the offset to 0, length to 2 and resizes the reference array if needed.
public static short asShort(BytesRef b)
NOTE: this method does NOT check the bounds of the referenced array.
public static int asInt(BytesRef b)
NOTE: this method does NOT check the bounds of the referenced array.
public static long asLong(BytesRef b)
NOTE: this method does NOT check the bounds of the referenced array.
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.