Package org.apache.solr.uninverting
Interface FieldCache
-
- All Known Implementing Classes:
FieldCacheImpl
public interface FieldCache
Expert: Maintains caches of term values.Created: May 19, 2004 11:13:14 AM
- Since:
- lucene 1.4
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface 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.
-
Field Summary
Fields Modifier and Type Field 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 byNumericUtils
, e.g.static FieldCache.Parser
FLOAT_POINT_PARSER
A parser instance for float values encoded byNumericUtils
, e.g.static FieldCache.Parser
INT_POINT_PARSER
A parser instance for int values encoded byNumericUtils
, e.g.static org.apache.lucene.util.BytesRef
INT32_TERM_PREFIX
Can be passed togetDocTermOrds(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.util.BytesRef)
to filter for 32-bit numeric termsstatic org.apache.lucene.util.BytesRef
INT64_TERM_PREFIX
Can be passed togetDocTermOrds(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.util.BytesRef)
to filter for 64-bit numeric termsstatic FieldCache.Parser
LEGACY_DOUBLE_PARSER
Deprecated.Index with points and useDOUBLE_POINT_PARSER
instead.static FieldCache.Parser
LEGACY_FLOAT_PARSER
Deprecated.Index with points and useFLOAT_POINT_PARSER
instead.static FieldCache.Parser
LEGACY_INT_PARSER
Deprecated.Index with points and useINT_POINT_PARSER
instead.static FieldCache.Parser
LEGACY_LONG_PARSER
Deprecated.Index with points and useLONG_POINT_PARSER
instead.static FieldCache.Parser
LONG_POINT_PARSER
A parser instance for long values encoded byNumericUtils
, e.g.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FieldCache.CacheEntry[]
getCacheEntries()
EXPERT: Generates an array of CacheEntry objects representing all items currently in the FieldCache.org.apache.lucene.util.Bits
getDocsWithField(org.apache.lucene.index.LeafReader reader, String field, FieldCache.Parser parser)
Checks the internal cache for an appropriate entry, and if none is found, reads the terms/points infield
and returns a bit set at the size ofreader.maxDoc()
, with turned on bits for each docid that does have a value for this field.org.apache.lucene.index.SortedSetDocValues
getDocTermOrds(org.apache.lucene.index.LeafReader reader, String field, org.apache.lucene.util.BytesRef prefix)
Checks the internal cache for an appropriate entry, and if none is found, reads the term values infield
and returns aDocTermOrds
instance, providing a method to retrieve the terms (as ords) per document.org.apache.lucene.index.NumericDocValues
getNumerics(org.apache.lucene.index.LeafReader reader, String field, FieldCache.Parser parser)
Returns aNumericDocValues
over the values found in documents in the given field.org.apache.lucene.index.BinaryDocValues
getTerms(org.apache.lucene.index.LeafReader reader, String field)
Checks the internal cache for an appropriate entry, and if none is found, reads the term values infield
and returns aBinaryDocValues
instance, providing a method to retrieve the term (as a BytesRef) per document.org.apache.lucene.index.BinaryDocValues
getTerms(org.apache.lucene.index.LeafReader reader, String field, float acceptableOverheadRatio)
Expert: just likegetTerms(org.apache.lucene.index.LeafReader,String)
, but you can specify whether more RAM should be consumed in exchange for faster lookups (default is "true").org.apache.lucene.index.SortedDocValues
getTermsIndex(org.apache.lucene.index.LeafReader reader, String field)
Checks the internal cache for an appropriate entry, and if none is found, reads the term values infield
and returns aSortedDocValues
instance, providing methods to retrieve sort ordinals and terms (as a ByteRef) per document.org.apache.lucene.index.SortedDocValues
getTermsIndex(org.apache.lucene.index.LeafReader reader, String field, float acceptableOverheadRatio)
Expert: just likegetTermsIndex(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(org.apache.lucene.index.IndexReader.CacheKey coreCacheKey)
Expert: drops all cache entries associated with this readerIndexReader.CacheHelper.getKey()
.
-
-
-
Field Detail
-
DEFAULT
static final FieldCache DEFAULT
Expert: The cache used internally by sorting and range query classes.
-
INT_POINT_PARSER
static final FieldCache.Parser INT_POINT_PARSER
A parser instance for int values encoded byNumericUtils
, e.g. when indexed viaIntPoint
.
-
LONG_POINT_PARSER
static final FieldCache.Parser LONG_POINT_PARSER
A parser instance for long values encoded byNumericUtils
, e.g. when indexed viaLongPoint
.
-
FLOAT_POINT_PARSER
static final FieldCache.Parser FLOAT_POINT_PARSER
A parser instance for float values encoded byNumericUtils
, e.g. when indexed viaFloatPoint
.
-
DOUBLE_POINT_PARSER
static final FieldCache.Parser DOUBLE_POINT_PARSER
A parser instance for double values encoded byNumericUtils
, e.g. when indexed viaDoublePoint
.
-
LEGACY_INT_PARSER
@Deprecated static final FieldCache.Parser LEGACY_INT_PARSER
Deprecated.Index with points and useINT_POINT_PARSER
instead.A parser instance for int values encoded byLegacyNumericUtils
, e.g. when indexed viaLegacyIntField
/LegacyNumericTokenStream
.
-
LEGACY_FLOAT_PARSER
@Deprecated static final FieldCache.Parser LEGACY_FLOAT_PARSER
Deprecated.Index with points and useFLOAT_POINT_PARSER
instead.A parser instance for float values encoded withLegacyNumericUtils
, e.g. when indexed viaLegacyFloatField
/LegacyNumericTokenStream
.
-
LEGACY_LONG_PARSER
@Deprecated static final FieldCache.Parser LEGACY_LONG_PARSER
Deprecated.Index with points and useLONG_POINT_PARSER
instead.A parser instance for long values encoded byLegacyNumericUtils
, e.g. when indexed viaLegacyLongField
/LegacyNumericTokenStream
.
-
LEGACY_DOUBLE_PARSER
@Deprecated static final FieldCache.Parser LEGACY_DOUBLE_PARSER
Deprecated.Index with points and useDOUBLE_POINT_PARSER
instead.A parser instance for double values encoded withLegacyNumericUtils
, e.g. when indexed viaLegacyDoubleField
/LegacyNumericTokenStream
.
-
INT32_TERM_PREFIX
static final org.apache.lucene.util.BytesRef INT32_TERM_PREFIX
Can be passed togetDocTermOrds(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.util.BytesRef)
to filter for 32-bit numeric terms
-
INT64_TERM_PREFIX
static final org.apache.lucene.util.BytesRef INT64_TERM_PREFIX
Can be passed togetDocTermOrds(org.apache.lucene.index.LeafReader, java.lang.String, org.apache.lucene.util.BytesRef)
to filter for 64-bit numeric terms
-
-
Method Detail
-
getDocsWithField
org.apache.lucene.util.Bits getDocsWithField(org.apache.lucene.index.LeafReader reader, String field, FieldCache.Parser parser) throws IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the terms/points infield
and returns a bit set at the size ofreader.maxDoc()
, with turned on bits for each docid that does have a value for this field.- Parameters:
parser
- May benull
if coming from the inverted index, otherwise can be aFieldCache.PointParser
to compute from point values.- Throws:
IOException
-
getNumerics
org.apache.lucene.index.NumericDocValues getNumerics(org.apache.lucene.index.LeafReader reader, String field, FieldCache.Parser parser) throws IOException
Returns aNumericDocValues
over the values found in documents in the given field. If the field was indexed asNumericDocValuesField
, it simply usesLeafReader.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 infield
as longs and returns an array of sizereader.maxDoc()
of the value each document has in the given field.- Parameters:
reader
- Used to get field values.field
- Which field contains the longs.parser
- Computes long for string values. May benull
if the requested field was indexed asNumericDocValuesField
orLegacyLongField
.- Returns:
- The values in the given field for each document.
- Throws:
IOException
- If any error occurs.
-
getTerms
org.apache.lucene.index.BinaryDocValues getTerms(org.apache.lucene.index.LeafReader reader, String field) throws IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the term values infield
and returns aBinaryDocValues
instance, providing a method to retrieve the term (as a BytesRef) per document.- Parameters:
reader
- Used to get field values.field
- Which field contains the strings.- Returns:
- The values in the given field for each document.
- Throws:
IOException
- If any error occurs.
-
getTerms
org.apache.lucene.index.BinaryDocValues getTerms(org.apache.lucene.index.LeafReader reader, String field, float acceptableOverheadRatio) throws IOException
Expert: just likegetTerms(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.- Throws:
IOException
-
getTermsIndex
org.apache.lucene.index.SortedDocValues getTermsIndex(org.apache.lucene.index.LeafReader reader, String field) throws IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the term values infield
and returns aSortedDocValues
instance, providing methods to retrieve sort ordinals and terms (as a ByteRef) per document.- Parameters:
reader
- Used to get field values.field
- Which field contains the strings.- Returns:
- The values in the given field for each document.
- Throws:
IOException
- If any error occurs.
-
getTermsIndex
org.apache.lucene.index.SortedDocValues getTermsIndex(org.apache.lucene.index.LeafReader reader, String field, float acceptableOverheadRatio) throws IOException
Expert: just likegetTermsIndex(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.- Throws:
IOException
-
getDocTermOrds
org.apache.lucene.index.SortedSetDocValues getDocTermOrds(org.apache.lucene.index.LeafReader reader, String field, org.apache.lucene.util.BytesRef prefix) throws IOException
Checks the internal cache for an appropriate entry, and if none is found, reads the term values infield
and returns aDocTermOrds
instance, providing a method to retrieve the terms (as ords) per document.- Parameters:
reader
- Used to build aDocTermOrds
instancefield
- Which field contains the strings.prefix
- prefix for a subset of the terms which should be uninverted. Can be null orINT32_TERM_PREFIX
orINT64_TERM_PREFIX
- Returns:
- a
DocTermOrds
instance - Throws:
IOException
- If any error occurs.
-
getCacheEntries
FieldCache.CacheEntry[] getCacheEntries()
EXPERT: Generates an array of CacheEntry objects representing all items currently in the 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.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
purgeAllCaches
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.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
purgeByCacheKey
void purgeByCacheKey(org.apache.lucene.index.IndexReader.CacheKey coreCacheKey)
Expert: drops all cache entries associated with this readerIndexReader.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.
-
-