class FieldCacheImpl extends java.lang.Object implements FieldCache
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
FieldCacheImpl.BinaryDocValuesCache |
private static class |
FieldCacheImpl.BinaryDocValuesImpl |
(package private) static class |
FieldCacheImpl.BitsEntry |
(package private) static class |
FieldCacheImpl.Cache
Expert: Internal cache.
|
(package private) static class |
FieldCacheImpl.CacheKey
Expert: Every composite-key in the internal cache is of this type.
|
(package private) static class |
FieldCacheImpl.DocsWithFieldCache |
(package private) static class |
FieldCacheImpl.DocTermOrdsCache |
private static class |
FieldCacheImpl.GrowableWriterAndMinValue |
private static class |
FieldCacheImpl.HoldsOneThing<T> |
(package private) static class |
FieldCacheImpl.LongCache |
(package private) static class |
FieldCacheImpl.LongsFromArray |
(package private) static class |
FieldCacheImpl.SortedDocValuesCache |
static class |
FieldCacheImpl.SortedDocValuesImpl |
private static class |
FieldCacheImpl.Uninvert |
FieldCache.CacheEntry, FieldCache.CreationPlaceholder, FieldCache.Parser, FieldCache.PointParser| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.Class<?>,FieldCacheImpl.Cache> |
caches |
private java.io.PrintStream |
infoStream |
(package private) LeafReader.CoreClosedListener |
purgeCore |
DEFAULT, DOUBLE_POINT_PARSER, FLOAT_POINT_PARSER, INT_POINT_PARSER, INT32_TERM_PREFIX, INT64_TERM_PREFIX, LEGACY_DOUBLE_PARSER, LEGACY_FLOAT_PARSER, LEGACY_INT_PARSER, LEGACY_LONG_PARSER, LONG_POINT_PARSER| Constructor and Description |
|---|
FieldCacheImpl() |
| Modifier and Type | Method and Description |
|---|---|
FieldCache.CacheEntry[] |
getCacheEntries()
EXPERT: Generates an array of CacheEntry objects representing all items
currently in the FieldCache.
|
Bits |
getDocsWithField(LeafReader reader,
java.lang.String field,
FieldCache.Parser parser)
Checks the internal cache for an appropriate entry, and if none is found,
reads the terms/points in
field and returns a bit set at the size of
reader.maxDoc(), with turned on bits for each docid that
does have a value for this field. |
SortedSetDocValues |
getDocTermOrds(LeafReader reader,
java.lang.String field,
BytesRef prefix)
Checks the internal cache for an appropriate entry, and if none is found, reads the term values
in
field and returns a DocTermOrds instance, providing a method to retrieve
the terms (as ords) per document. |
java.io.PrintStream |
getInfoStream()
counterpart of
FieldCache.setInfoStream(PrintStream) |
NumericDocValues |
getNumerics(LeafReader reader,
java.lang.String field,
FieldCache.Parser parser,
boolean setDocsWithField)
Returns a
NumericDocValues over the values found in documents in the given
field. |
BinaryDocValues |
getTerms(LeafReader reader,
java.lang.String field,
boolean setDocsWithField)
Checks the internal cache for an appropriate entry, and if none
is found, reads the term values in
field
and returns a BinaryDocValues instance, providing a
method to retrieve the term (as a BytesRef) per document. |
BinaryDocValues |
getTerms(LeafReader reader,
java.lang.String field,
boolean setDocsWithField,
float acceptableOverheadRatio)
Expert: just like
FieldCache.getTerms(org.apache.lucene.index.LeafReader,String,boolean),
but you can specify whether more RAM should be consumed in exchange for
faster lookups (default is "true"). |
SortedDocValues |
getTermsIndex(LeafReader reader,
java.lang.String field)
Checks the internal cache for an appropriate entry, and if none
is found, reads the term values in
field
and returns a SortedDocValues instance,
providing methods to retrieve sort ordinals and terms
(as a ByteRef) per document. |
SortedDocValues |
getTermsIndex(LeafReader reader,
java.lang.String field,
float acceptableOverheadRatio)
Expert: just like
FieldCache.getTermsIndex(org.apache.lucene.index.LeafReader,String), but you can specify
whether more RAM should be consumed in exchange for
faster lookups (default is "true"). |
private void |
init() |
private void |
initReader(LeafReader reader) |
void |
purgeAllCaches()
EXPERT: Instructs the FieldCache to forcibly expunge all entries
from the underlying caches.
|
void |
purgeByCacheKey(java.lang.Object coreCacheKey)
Expert: drops all cache entries associated with this
reader
IndexReader.getCoreCacheKey(). |
(package private) void |
setDocsWithField(LeafReader reader,
java.lang.String field,
Bits docsWithField,
FieldCache.Parser parser) |
void |
setInfoStream(java.io.PrintStream stream)
If non-null, FieldCacheImpl will warn whenever
entries are created that are not sane according to
FieldCacheSanityChecker. |
private java.util.Map<java.lang.Class<?>,FieldCacheImpl.Cache> caches
final LeafReader.CoreClosedListener purgeCore
private volatile java.io.PrintStream infoStream
private void init()
public void purgeAllCaches()
FieldCacheEXPERT: Instructs the FieldCache to forcibly expunge all entries from the underlying caches. This is intended only to be used for test methods as a way to ensure a known base state of the Cache (with out needing to rely on GC to free WeakReferences). It should not be relied on for "Cache maintenance" in general application code.
purgeAllCaches in interface FieldCachepublic void purgeByCacheKey(java.lang.Object coreCacheKey)
FieldCacheIndexReader.getCoreCacheKey(). NOTE: this cache key must
precisely match the reader that the cache entry is
keyed on. If you pass a top-level reader, it usually
will have no effect as Lucene now caches at the segment
reader level.purgeByCacheKey in interface FieldCachepublic FieldCache.CacheEntry[] getCacheEntries()
FieldCacheNOTE: These CacheEntry objects maintain a strong reference to the Cached Values. Maintaining references to a CacheEntry the AtomicIndexReader associated with it has garbage collected will prevent the Value itself from being garbage collected when the Cache drops the WeakReference.
getCacheEntries in interface FieldCacheprivate void initReader(LeafReader reader)
void setDocsWithField(LeafReader reader, java.lang.String field, Bits docsWithField, FieldCache.Parser parser)
public Bits getDocsWithField(LeafReader reader, java.lang.String field, FieldCache.Parser parser) throws java.io.IOException
FieldCachefield and returns a bit set at the size of
reader.maxDoc(), with turned on bits for each docid that
does have a value for this field.getDocsWithField in interface FieldCacheparser - May be null if coming from the inverted index, otherwise
can be a FieldCache.PointParser to compute from point values.java.io.IOExceptionpublic NumericDocValues getNumerics(LeafReader reader, java.lang.String field, FieldCache.Parser parser, boolean setDocsWithField) throws java.io.IOException
FieldCacheNumericDocValues over the values found in documents in the given
field. If the field was indexed as NumericDocValuesField, it simply
uses LeafReader.getNumericDocValues(String) to read the values.
Otherwise, it checks the internal cache for an appropriate entry, and if
none is found, reads the terms/points in field as longs and returns
an array of size reader.maxDoc() of the value each document
has in the given field.getNumerics in interface FieldCachereader - Used to get field values.field - Which field contains the longs.parser - Computes long for string values. May be null if the
requested field was indexed as NumericDocValuesField or
LegacyLongField.setDocsWithField - If true then FieldCache.getDocsWithField(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.uninverting.FieldCache.Parser) will also be computed and
stored in the FieldCache.java.io.IOException - If any error occurs.public SortedDocValues getTermsIndex(LeafReader reader, java.lang.String field) throws java.io.IOException
FieldCachefield
and returns a SortedDocValues instance,
providing methods to retrieve sort ordinals and terms
(as a ByteRef) per document.getTermsIndex in interface FieldCachereader - Used to get field values.field - Which field contains the strings.java.io.IOException - If any error occurs.public SortedDocValues getTermsIndex(LeafReader reader, java.lang.String field, float acceptableOverheadRatio) throws java.io.IOException
FieldCacheFieldCache.getTermsIndex(org.apache.lucene.index.LeafReader,String), but you can specify
whether more RAM should be consumed in exchange for
faster lookups (default is "true"). Note that the
first call for a given reader and field "wins",
subsequent calls will share the same cache entry.getTermsIndex in interface FieldCachejava.io.IOExceptionpublic BinaryDocValues getTerms(LeafReader reader, java.lang.String field, boolean setDocsWithField) throws java.io.IOException
FieldCachefield
and returns a BinaryDocValues instance, providing a
method to retrieve the term (as a BytesRef) per document.getTerms in interface FieldCachereader - Used to get field values.field - Which field contains the strings.setDocsWithField - If true then FieldCache.getDocsWithField(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.uninverting.FieldCache.Parser) will
also be computed and stored in the FieldCache.java.io.IOException - If any error occurs.public BinaryDocValues getTerms(LeafReader reader, java.lang.String field, boolean setDocsWithField, float acceptableOverheadRatio) throws java.io.IOException
FieldCacheFieldCache.getTerms(org.apache.lucene.index.LeafReader,String,boolean),
but you can specify whether more RAM should be consumed in exchange for
faster lookups (default is "true"). Note that the
first call for a given reader and field "wins",
subsequent calls will share the same cache entry.getTerms in interface FieldCachejava.io.IOExceptionpublic SortedSetDocValues getDocTermOrds(LeafReader reader, java.lang.String field, BytesRef prefix) throws java.io.IOException
FieldCachefield and returns a DocTermOrds instance, providing a method to retrieve
the terms (as ords) per document.getDocTermOrds in interface FieldCachereader - Used to build a DocTermOrds instancefield - Which field contains the strings.prefix - prefix for a subset of the terms which should be uninverted. Can be null or
FieldCache.INT32_TERM_PREFIX or FieldCache.INT64_TERM_PREFIXDocTermOrds instancejava.io.IOException - If any error occurs.public void setInfoStream(java.io.PrintStream stream)
FieldCacheFieldCacheSanityChecker.setInfoStream in interface FieldCachepublic java.io.PrintStream getInfoStream()
FieldCacheFieldCache.setInfoStream(PrintStream)getInfoStream in interface FieldCache