public class CachedOrdinalsReader extends OrdinalsReader implements Accountable
CachedOrdinalsReader.CachedOrds holds the ordinals in a raw int[], and therefore consumes as much RAM as the total
number of ordinals found in the segment, but saves the
CPU cost of decoding ordinals during facet counting.
NOTE: every CachedOrdinalsReader.CachedOrds is limited to 2.1B
total ordinals. If that is a limitation for you then
consider limiting the segment size to fewer documents, or
use an alternative cache which pages through the category
ordinals.
NOTE: when using this cache, it is advised to use
a DocValuesFormat that does not cache the data in
memory, at least for the category lists fields, or
otherwise you'll be doing double-caching.
NOTE: create one instance of this and re-use it for all facet implementations (the cache is per-instance, not static).
| Modifier and Type | Class and Description |
|---|---|
static class |
CachedOrdinalsReader.CachedOrds
Holds the cached ordinals in two parallel
int[] arrays. |
OrdinalsReader.OrdinalsSegmentReaderNULL_ACCOUNTABLE| Constructor and Description |
|---|
CachedOrdinalsReader(OrdinalsReader source)
Sole constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Collection<Accountable> |
getChildResources() |
String |
getIndexFieldName()
Returns the indexed field name this
OrdinalsReader is reading from. |
OrdinalsReader.OrdinalsSegmentReader |
getReader(LeafReaderContext context)
Set current atomic reader.
|
long |
ramBytesUsed() |
public CachedOrdinalsReader(OrdinalsReader source)
public String getIndexFieldName()
OrdinalsReaderOrdinalsReader is reading from.getIndexFieldName in class OrdinalsReaderpublic OrdinalsReader.OrdinalsSegmentReader getReader(LeafReaderContext context) throws IOException
OrdinalsReadergetReader in class OrdinalsReaderIOExceptionpublic long ramBytesUsed()
ramBytesUsed in interface Accountablepublic Collection<Accountable> getChildResources()
getChildResources in interface AccountableCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.