public class FieldCacheImpl extends Object implements FieldCache
Modifier and Type | Class and Description |
---|---|
static class |
FieldCacheImpl.BinaryDocValuesImpl |
static class |
FieldCacheImpl.LongsFromArray |
static class |
FieldCacheImpl.SortedDocValuesImpl |
FieldCache.CacheEntry, FieldCache.CreationPlaceholder, FieldCache.Parser, FieldCache.PointParser
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
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,
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,
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. |
NumericDocValues |
getNumerics(LeafReader reader,
String field,
FieldCache.Parser parser)
Returns a
NumericDocValues over the values found in documents in the given
field. |
BinaryDocValues |
getTerms(LeafReader reader,
String field)
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,
String field,
float acceptableOverheadRatio)
Expert: just like
FieldCache.getTerms(org.apache.lucene.index.LeafReader,String) ,
but you can specify whether more RAM should be consumed in exchange for
faster lookups (default is "true"). |
SortedDocValues |
getTermsIndex(LeafReader reader,
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,
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"). |
void |
purgeAllCaches()
EXPERT: Instructs the FieldCache to forcibly expunge all entries
from the underlying caches.
|
void |
purgeByCacheKey(IndexReader.CacheKey coreCacheKey)
Expert: drops all cache entries associated with this
reader
IndexReader.CacheHelper.getKey() . |
public void purgeAllCaches()
FieldCache
EXPERT: 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 FieldCache
public void purgeByCacheKey(IndexReader.CacheKey coreCacheKey)
FieldCache
IndexReader.CacheHelper.getKey()
.
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 FieldCache
public FieldCache.CacheEntry[] getCacheEntries()
FieldCache
NOTE: 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 FieldCache
public Bits getDocsWithField(LeafReader reader, String field, FieldCache.Parser parser) throws IOException
FieldCache
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.getDocsWithField
in interface FieldCache
parser
- May be null
if coming from the inverted index, otherwise
can be a FieldCache.PointParser
to compute from point values.IOException
public NumericDocValues getNumerics(LeafReader reader, String field, FieldCache.Parser parser) throws IOException
FieldCache
NumericDocValues
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 FieldCache
reader
- 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
.IOException
- If any error occurs.public SortedDocValues getTermsIndex(LeafReader reader, String field) throws IOException
FieldCache
field
and returns a SortedDocValues
instance,
providing methods to retrieve sort ordinals and terms
(as a ByteRef) per document.getTermsIndex
in interface FieldCache
reader
- Used to get field values.field
- Which field contains the strings.IOException
- If any error occurs.public SortedDocValues getTermsIndex(LeafReader reader, String field, float acceptableOverheadRatio) throws IOException
FieldCache
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"). Note that the
first call for a given reader and field "wins",
subsequent calls will share the same cache entry.getTermsIndex
in interface FieldCache
IOException
public BinaryDocValues getTerms(LeafReader reader, String field) throws IOException
FieldCache
field
and returns a BinaryDocValues
instance, providing a
method to retrieve the term (as a BytesRef) per document.getTerms
in interface FieldCache
reader
- Used to get field values.field
- Which field contains the strings.IOException
- If any error occurs.public BinaryDocValues getTerms(LeafReader reader, String field, float acceptableOverheadRatio) throws IOException
FieldCache
FieldCache.getTerms(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.getTerms
in interface FieldCache
IOException
public SortedSetDocValues getDocTermOrds(LeafReader reader, String field, BytesRef prefix) throws IOException
FieldCache
field
and returns a DocTermOrds
instance, providing a method to retrieve
the terms (as ords) per document.getDocTermOrds
in interface FieldCache
reader
- 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_PREFIX
DocTermOrds
instanceIOException
- If any error occurs.Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.