java.lang.Object
org.apache.lucene.index.FieldUpdatesBuffer
This class efficiently buffers numeric and binary field updates and stores terms, values and
metadata in a memory efficient way without creating large amounts of objects. Update terms are
stored without de-duplicating the update term. In general we try to optimize for several
use-cases. For instance we try to use constant space for update terms field since the common case
always updates on the same field. Also for docUpTo we try to optimize for the case when updates
should be applied to all docs ie. docUpTo=Integer.MAX_VALUE. In other cases each update will
likely have a different docUpTo. Along the same lines this impl optimizes the case when all
updates have a value. Lastly, if all updates share the same value for a numeric field we only
store the value once.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
Struct like class that is used to iterate over all updates in this buffer(package private) class
An iterator that iterates over all updates in insertion order -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Counter
private final BytesRefArray
private int[]
private String[]
private boolean
private FixedBitSet
private final boolean
private long
private long
private long[]
private int
private static final long
private static final long
private BytesRefArray.SortState
private final BytesRefArray
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
FieldUpdatesBuffer
(Counter bytesUsed, DocValuesUpdate.BinaryDocValuesUpdate initialValue, int docUpTo) (package private)
FieldUpdatesBuffer
(Counter bytesUsed, DocValuesUpdate.NumericDocValuesUpdate initialValue, int docUpTo) private
FieldUpdatesBuffer
(Counter bytesUsed, DocValuesUpdate initialValue, int docUpTo, boolean isNumeric) -
Method Summary
Modifier and TypeMethodDescription(package private) void
(package private) void
addNoValue
(Term term, int docUpTo) (package private) void
(package private) void
private int
(package private) void
finish()
private static int
getArrayIndex
(int arrayLength, int index) (package private) long
(package private) long
(package private) long
getNumericValue
(int idx) (package private) boolean
(package private) boolean
(package private) FieldUpdatesBuffer.BufferedUpdateIterator
iterator()
private static long
sizeOfString
(String string)
-
Field Details
-
SELF_SHALLOW_SIZE
private static final long SELF_SHALLOW_SIZE -
STRING_SHALLOW_SIZE
private static final long STRING_SHALLOW_SIZE -
bytesUsed
-
numUpdates
private int numUpdates -
termValues
-
termSortState
-
byteValues
-
docsUpTo
private int[] docsUpTo -
numericValues
private long[] numericValues -
hasValues
-
maxNumeric
private long maxNumeric -
minNumeric
private long minNumeric -
fields
-
isNumeric
private final boolean isNumeric -
finished
private boolean finished
-
-
Constructor Details
-
FieldUpdatesBuffer
private FieldUpdatesBuffer(Counter bytesUsed, DocValuesUpdate initialValue, int docUpTo, boolean isNumeric) -
FieldUpdatesBuffer
FieldUpdatesBuffer(Counter bytesUsed, DocValuesUpdate.NumericDocValuesUpdate initialValue, int docUpTo) -
FieldUpdatesBuffer
FieldUpdatesBuffer(Counter bytesUsed, DocValuesUpdate.BinaryDocValuesUpdate initialValue, int docUpTo)
-
-
Method Details
-
sizeOfString
-
getMaxNumeric
long getMaxNumeric() -
getMinNumeric
long getMinNumeric() -
add
-
addUpdate
-
addNoValue
-
addUpdate
-
append
-
finish
void finish() -
iterator
FieldUpdatesBuffer.BufferedUpdateIterator iterator() -
isNumeric
boolean isNumeric() -
hasSingleValue
boolean hasSingleValue() -
getNumericValue
long getNumericValue(int idx) -
getArrayIndex
private static int getArrayIndex(int arrayLength, int index)
-