public interface FieldCache
Created: May 19, 2004 11:13:14 AM
Modifier and Type | Interface and Description |
---|---|
static class |
FieldCache.CacheEntry
EXPERT: A unique Identifier/Description for each item in the FieldCache.
|
static class |
FieldCache.CreationPlaceholder
Placeholder indicating creation of this cache is currently in-progress.
|
static interface |
FieldCache.Parser
interface to all parsers.
|
static class |
FieldCache.PointParser
Base class for points parsers.
|
Modifier and Type | Field and Description |
---|---|
static FieldCache |
DEFAULT
Expert: The cache used internally by sorting and range query classes.
|
static FieldCache.Parser |
DOUBLE_POINT_PARSER
A parser instance for double values encoded by
NumericUtils , e.g. |
static FieldCache.Parser |
FLOAT_POINT_PARSER
A parser instance for float values encoded by
NumericUtils , e.g. |
static FieldCache.Parser |
INT_POINT_PARSER
A parser instance for int values encoded by
NumericUtils , e.g. |
static BytesRef |
INT32_TERM_PREFIX
Can be passed to
getDocTermOrds(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.util.BytesRef) to filter for 32-bit numeric terms |
static BytesRef |
INT64_TERM_PREFIX
Can be passed to
getDocTermOrds(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.util.BytesRef) to filter for 64-bit numeric terms |
static FieldCache.Parser |
LEGACY_DOUBLE_PARSER
Deprecated.
Index with points and use
DOUBLE_POINT_PARSER instead. |
static FieldCache.Parser |
LEGACY_FLOAT_PARSER
Deprecated.
Index with points and use
FLOAT_POINT_PARSER instead. |
static FieldCache.Parser |
LEGACY_INT_PARSER
Deprecated.
Index with points and use
INT_POINT_PARSER instead. |
static FieldCache.Parser |
LEGACY_LONG_PARSER
Deprecated.
Index with points and use
LONG_POINT_PARSER instead. |
static FieldCache.Parser |
LONG_POINT_PARSER
A parser instance for long values encoded by
NumericUtils , e.g. |
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
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
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() . |
static final FieldCache DEFAULT
static final FieldCache.Parser INT_POINT_PARSER
NumericUtils
, e.g. when indexed
via IntPoint
.static final FieldCache.Parser LONG_POINT_PARSER
NumericUtils
, e.g. when indexed
via LongPoint
.static final FieldCache.Parser FLOAT_POINT_PARSER
NumericUtils
, e.g. when indexed
via FloatPoint
.static final FieldCache.Parser DOUBLE_POINT_PARSER
NumericUtils
, e.g. when indexed
via DoublePoint
.@Deprecated static final FieldCache.Parser LEGACY_INT_PARSER
INT_POINT_PARSER
instead.LegacyNumericUtils
, e.g. when indexed
via LegacyIntField
/LegacyNumericTokenStream
.@Deprecated static final FieldCache.Parser LEGACY_FLOAT_PARSER
FLOAT_POINT_PARSER
instead.LegacyNumericUtils
, e.g. when indexed
via LegacyFloatField
/LegacyNumericTokenStream
.@Deprecated static final FieldCache.Parser LEGACY_LONG_PARSER
LONG_POINT_PARSER
instead.LegacyNumericUtils
, e.g. when indexed
via LegacyLongField
/LegacyNumericTokenStream
.@Deprecated static final FieldCache.Parser LEGACY_DOUBLE_PARSER
DOUBLE_POINT_PARSER
instead.LegacyNumericUtils
, e.g. when indexed
via LegacyDoubleField
/LegacyNumericTokenStream
.static final BytesRef INT32_TERM_PREFIX
getDocTermOrds(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.util.BytesRef)
to filter for 32-bit numeric termsstatic final BytesRef INT64_TERM_PREFIX
getDocTermOrds(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.util.BytesRef)
to filter for 64-bit numeric termsBits getDocsWithField(LeafReader reader, String field, FieldCache.Parser parser) throws IOException
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.parser
- May be null
if coming from the inverted index, otherwise
can be a FieldCache.PointParser
to compute from point values.IOException
NumericDocValues getNumerics(LeafReader reader, String field, FieldCache.Parser parser) throws IOException
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.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.BinaryDocValues getTerms(LeafReader reader, String field) throws IOException
field
and returns a BinaryDocValues
instance, providing a
method to retrieve the term (as a BytesRef) per document.reader
- Used to get field values.field
- Which field contains the strings.IOException
- If any error occurs.BinaryDocValues getTerms(LeafReader reader, String field, float acceptableOverheadRatio) throws IOException
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.IOException
SortedDocValues getTermsIndex(LeafReader reader, String field) throws IOException
field
and returns a SortedDocValues
instance,
providing methods to retrieve sort ordinals and terms
(as a ByteRef) per document.reader
- Used to get field values.field
- Which field contains the strings.IOException
- If any error occurs.SortedDocValues getTermsIndex(LeafReader reader, String field, float acceptableOverheadRatio) throws IOException
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.IOException
SortedSetDocValues getDocTermOrds(LeafReader reader, String field, BytesRef prefix) throws IOException
field
and returns a DocTermOrds
instance, providing a method to retrieve
the terms (as ords) per document.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
INT32_TERM_PREFIX
or INT64_TERM_PREFIX
DocTermOrds
instanceIOException
- If any error occurs.FieldCache.CacheEntry[] getCacheEntries()
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.
void purgeAllCaches()
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.
void purgeByCacheKey(IndexReader.CacheKey coreCacheKey)
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.Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.