Package org.apache.lucene.index
Class FieldUpdatesBuffer
- java.lang.Object
-
- org.apache.lucene.index.FieldUpdatesBuffer
-
final class FieldUpdatesBuffer extends java.lang.ObjectThis 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 Classes Modifier and Type Class Description (package private) static classFieldUpdatesBuffer.BufferedUpdateStruct like class that is used to iterate over all updates in this buffer(package private) classFieldUpdatesBuffer.BufferedUpdateIteratorAn iterator that iterates over all updates in insertion order
-
Field Summary
Fields Modifier and Type Field Description private CounterbytesUsedprivate BytesRefArraybyteValuesprivate int[]docsUpToprivate java.lang.String[]fieldsprivate booleanfinishedprivate FixedBitSethasValuesprivate booleanisNumericprivate longmaxNumericprivate longminNumericprivate long[]numericValuesprivate intnumUpdatesprivate static longSELF_SHALLOW_SIZEprivate static longSTRING_SHALLOW_SIZEprivate BytesRefArray.SortStatetermSortStateprivate BytesRefArraytermValues
-
Constructor Summary
Constructors Modifier Constructor Description (package private)FieldUpdatesBuffer(Counter bytesUsed, DocValuesUpdate.BinaryDocValuesUpdate initialValue, int docUpTo)(package private)FieldUpdatesBuffer(Counter bytesUsed, DocValuesUpdate.NumericDocValuesUpdate initialValue, int docUpTo)privateFieldUpdatesBuffer(Counter bytesUsed, DocValuesUpdate initialValue, int docUpTo, boolean isNumeric)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidadd(java.lang.String field, int docUpTo, int ord, boolean hasValue)(package private) voidaddNoValue(Term term, int docUpTo)(package private) voidaddUpdate(Term term, long value, int docUpTo)(package private) voidaddUpdate(Term term, BytesRef value, int docUpTo)private intappend(Term term)(package private) voidfinish()private static intgetArrayIndex(int arrayLength, int index)(package private) longgetMaxNumeric()(package private) longgetMinNumeric()(package private) longgetNumericValue(int idx)(package private) booleanhasSingleValue()(package private) booleanisNumeric()(package private) FieldUpdatesBuffer.BufferedUpdateIteratoriterator()private static longsizeOfString(java.lang.String string)
-
-
-
Field Detail
-
SELF_SHALLOW_SIZE
private static final long SELF_SHALLOW_SIZE
-
STRING_SHALLOW_SIZE
private static final long STRING_SHALLOW_SIZE
-
bytesUsed
private final Counter bytesUsed
-
numUpdates
private int numUpdates
-
termValues
private final BytesRefArray termValues
-
termSortState
private BytesRefArray.SortState termSortState
-
byteValues
private final BytesRefArray byteValues
-
docsUpTo
private int[] docsUpTo
-
numericValues
private long[] numericValues
-
hasValues
private FixedBitSet hasValues
-
maxNumeric
private long maxNumeric
-
minNumeric
private long minNumeric
-
fields
private java.lang.String[] fields
-
isNumeric
private final boolean isNumeric
-
finished
private boolean finished
-
-
Constructor Detail
-
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 Detail
-
sizeOfString
private static long sizeOfString(java.lang.String string)
-
getMaxNumeric
long getMaxNumeric()
-
getMinNumeric
long getMinNumeric()
-
add
void add(java.lang.String field, int docUpTo, int ord, boolean hasValue)
-
addUpdate
void addUpdate(Term term, long value, int docUpTo)
-
addNoValue
void addNoValue(Term term, int docUpTo)
-
append
private int append(Term term)
-
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)
-
-