public final class Bytes extends Object
Bytes.Mode.DEREF/Bytes.Mode.STRAIGHT x fixed-length/variable-length.
NOTE: Currently the total amount of byte[] data stored (across a single segment) cannot exceed 2GB.
NOTE: Each byte[] must be <= 32768 bytes in length
| Modifier and Type | Class and Description |
|---|---|
static class |
Bytes.Mode
Defines the
Writers store mode. |
| Modifier and Type | Method and Description |
|---|---|
static DocValues |
getValues(Directory dir,
String id,
Bytes.Mode mode,
boolean fixedSize,
int maxDoc,
Comparator<BytesRef> sortComparator,
IOContext context)
Creates a new
DocValues instance that provides either memory
resident or iterative access to a per-document stored byte[]
value. |
static DocValuesConsumer |
getWriter(Directory dir,
String id,
Bytes.Mode mode,
boolean fixedSize,
Comparator<BytesRef> sortComparator,
Counter bytesUsed,
IOContext context,
float acceptableOverheadRatio)
Creates a new byte[]
Writer instances for the given
directory. |
public static DocValuesConsumer getWriter(Directory dir, String id, Bytes.Mode mode, boolean fixedSize, Comparator<BytesRef> sortComparator, Counter bytesUsed, IOContext context, float acceptableOverheadRatio)
Writer instances for the given
directory.dir - the directory to write the values toid - the id used to create a unique file name. Usually composed out of
the segment name and a unique id per segment.mode - the writers store modefixedSize - true if all bytes subsequently passed to the
Writer will have the same lengthsortComparator - BytesRef comparator used by sorted variants.
If null BytesRef.getUTF8SortedAsUnicodeComparator()
is used insteadbytesUsed - an AtomicLong instance to track the used bytes within the
Writer. A call to DocValuesConsumer.finish(int) will release
all internally used resources and frees the memory tracking
reference.acceptableOverheadRatio - how to trade space for speed. This option is only applicable for
docvalues of type DocValues.Type.BYTES_FIXED_SORTED and
DocValues.Type.BYTES_VAR_SORTED.context - I/O ContextWriter instancePackedInts.getReader(org.apache.lucene.store.DataInput)public static DocValues getValues(Directory dir, String id, Bytes.Mode mode, boolean fixedSize, int maxDoc, Comparator<BytesRef> sortComparator, IOContext context) throws IOException
DocValues instance that provides either memory
resident or iterative access to a per-document stored byte[]
value. The returned DocValues instance will be initialized without
consuming a significant amount of memory.dir - the directory to load the DocValues from.id - the file ID in the Directory to load the values from.mode - the mode used to store the valuesfixedSize - true iff the values are stored with fixed-size,
otherwise falsemaxDoc - the number of document values stored for the given IDsortComparator - BytesRef comparator used by sorted variants.
If null BytesRef.getUTF8SortedAsUnicodeComparator()
is used insteadDocValues instance.IOException - if an IOException occursCopyright © 2000-2012 Apache Software Foundation. All Rights Reserved.