Interface IFieldCache
Expert: Maintains caches of term values.
Created: May 19, 2004 11:13:14 AM
@since lucene 1.4
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public interface IFieldCache
Properties
| Improve this Doc View SourceInfoStream
If non-null, Lucene.Net.Search.FieldCacheImpl will warn whenever entries are created that are not sane according to FieldCacheSanityChecker.
Declaration
TextWriter InfoStream { get; set; }
Property Value
Type | Description |
---|---|
System.IO.TextWriter |
Methods
| Improve this Doc View SourceGetBytes(AtomicReader, String, FieldCache.IByteParser, Boolean)
Checks the internal cache for an appropriate entry, and if none is found,
reads the terms in field
as bytes and returns an array of
size reader.MaxDoc
of the value each document has in the
given field.
Declaration
[Obsolete("(4.4) Index as a numeric field using Int32Field and then use GetInt32s(AtomicReader, string, bool) instead.")]
FieldCache.Bytes GetBytes(AtomicReader reader, string field, FieldCache.IByteParser parser, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the System.Bytes. |
FieldCache.IByteParser | parser | Computes System.Byte for string values. |
System.Boolean | setDocsWithField | If true then GetDocsWithField(AtomicReader, String) will also be computed and stored in the IFieldCache. |
Returns
Type | Description |
---|---|
FieldCache.Bytes | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetBytes(AtomicReader, String, Boolean)
Checks the internal cache for an appropriate entry, and if none is
found, reads the terms in field
as a single System.Byte and returns an array
of size reader.MaxDoc
of the value each document
has in the given field.
Declaration
[Obsolete("(4.4) Index as a numeric field using Int32Field and then use GetInt32s(AtomicReader, string, bool) instead.")]
FieldCache.Bytes GetBytes(AtomicReader reader, string field, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the single System.Byte values. |
System.Boolean | setDocsWithField | If true then GetDocsWithField(AtomicReader, String) will also be computed and stored in the IFieldCache. |
Returns
Type | Description |
---|---|
FieldCache.Bytes | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetCacheEntries()
EXPERT: Generates an array of FieldCache.CacheEntry objects representing all items currently in the IFieldCache.
NOTE: These FieldCache.CacheEntry objects maintain a strong reference to the Cached Values. Maintaining references to a FieldCache.CacheEntry the AtomicReader associated with it has garbage collected will prevent the Value itself from being garbage collected when the Cache drops the System.WeakReference.
Declaration
FieldCache.CacheEntry[] GetCacheEntries()
Returns
Type | Description |
---|---|
FieldCache.CacheEntry[] |
GetDocsWithField(AtomicReader, String)
Checks the internal cache for an appropriate entry, and if none is found,
reads the terms 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.
Declaration
IBits GetDocsWithField(AtomicReader reader, string field)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | |
System.String | field |
Returns
Type | Description |
---|---|
IBits |
GetDocTermOrds(AtomicReader, String)
Checks the internal cache for an appropriate entry, and if none is found, reads the term values
in field
and returns a SortedSetDocValues instance, providing a method to retrieve
the terms (as ords) per document.
Declaration
SortedSetDocValues GetDocTermOrds(AtomicReader reader, string field)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to build a SortedSetDocValues instance |
System.String | field | Which field contains the strings. |
Returns
Type | Description |
---|---|
SortedSetDocValues | a SortedSetDocValues instance |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetDoubles(AtomicReader, String, FieldCache.IDoubleParser, Boolean)
Returns a FieldCache.Doubles over the values found in documents in the given
field. If the field was indexed as NumericDocValuesField, it simply
uses GetNumericDocValues(String) to read the values.
Otherwise, it checks the internal cache for an appropriate entry, and if
none is found, reads the terms in field
as System.Doubles and returns
an array of size reader.MaxDoc
of the value each document
has in the given field.
Declaration
FieldCache.Doubles GetDoubles(AtomicReader reader, string field, FieldCache.IDoubleParser parser, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the System.Doubles. |
FieldCache.IDoubleParser | parser | Computes System.Double for string values. May be |
System.Boolean | setDocsWithField | If true then GetDocsWithField(AtomicReader, String) will also be computed and stored in the IFieldCache. |
Returns
Type | Description |
---|---|
FieldCache.Doubles | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetDoubles(AtomicReader, String, Boolean)
Returns a FieldCache.Doubles over the values found in documents in the given field.
Declaration
FieldCache.Doubles GetDoubles(AtomicReader reader, string field, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | |
System.String | field | |
System.Boolean | setDocsWithField |
Returns
Type | Description |
---|---|
FieldCache.Doubles |
See Also
| Improve this Doc View SourceGetInt16s(AtomicReader, String, FieldCache.IInt16Parser, Boolean)
Checks the internal cache for an appropriate entry, and if none is found,
reads the terms in field
as shorts and returns an array of
size reader.MaxDoc
of the value each document has in the
given field.
NOTE: this was getShorts() in Lucene
Declaration
[Obsolete("(4.4) Index as a numeric field using Int32Field and then use GetInt32s(AtomicReader, string, bool) instead.")]
FieldCache.Int16s GetInt16s(AtomicReader reader, string field, FieldCache.IInt16Parser parser, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the System.Int16s. |
FieldCache.IInt16Parser | parser | Computes System.Int16 for string values. |
System.Boolean | setDocsWithField | If true then GetDocsWithField(AtomicReader, String) will also be computed and stored in the IFieldCache. |
Returns
Type | Description |
---|---|
FieldCache.Int16s | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetInt16s(AtomicReader, String, Boolean)
Checks the internal cache for an appropriate entry, and if none is
found, reads the terms in field
as System.Int16s and returns an array
of size reader.MaxDoc
of the value each document
has in the given field.
NOTE: this was getShorts() in Lucene
Declaration
[Obsolete("(4.4) Index as a numeric field using Int32Field and then use GetInt32s(AtomicReader, string, bool) instead.")]
FieldCache.Int16s GetInt16s(AtomicReader reader, string field, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the System.Int16s. |
System.Boolean | setDocsWithField | If true then GetDocsWithField(AtomicReader, String) will also be computed and stored in the IFieldCache. |
Returns
Type | Description |
---|---|
FieldCache.Int16s | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetInt32s(AtomicReader, String, FieldCache.IInt32Parser, Boolean)
Returns an FieldCache.Int32s over the values found in documents in the given
field. If the field was indexed as NumericDocValuesField, it simply
uses GetNumericDocValues(String) to read the values.
Otherwise, it checks the internal cache for an appropriate entry, and if
none is found, reads the terms in field
as System.Int32s and returns
an array of size reader.MaxDoc
of the value each document
has in the given field.
NOTE: this was getInts() in Lucene
Declaration
FieldCache.Int32s GetInt32s(AtomicReader reader, string field, FieldCache.IInt32Parser parser, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the System.Int32s. |
FieldCache.IInt32Parser | parser | Computes System.Int32 for string values. May be |
System.Boolean | setDocsWithField | If true then GetDocsWithField(AtomicReader, String) will also be computed and stored in the IFieldCache. |
Returns
Type | Description |
---|---|
FieldCache.Int32s | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetInt32s(AtomicReader, String, Boolean)
Returns an FieldCache.Int32s over the values found in documents in the given field.
NOTE: this was getInts() in Lucene
Declaration
FieldCache.Int32s GetInt32s(AtomicReader reader, string field, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | |
System.String | field | |
System.Boolean | setDocsWithField |
Returns
Type | Description |
---|---|
FieldCache.Int32s |
See Also
| Improve this Doc View SourceGetInt64s(AtomicReader, String, FieldCache.IInt64Parser, Boolean)
Returns a FieldCache.Int64s over the values found in documents in the given
field. If the field was indexed as NumericDocValuesField, it simply
uses GetNumericDocValues(String) to read the values.
Otherwise, it checks the internal cache for an appropriate entry, and if
none is found, reads the terms in field
as System.Int64s and returns
an array of size reader.MaxDoc
of the value each document
has in the given field.
NOTE: this was getLongs() in Lucene
Declaration
FieldCache.Int64s GetInt64s(AtomicReader reader, string field, FieldCache.IInt64Parser parser, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the System.Int64s. |
FieldCache.IInt64Parser | parser | Computes System.Int64 for string values. May be |
System.Boolean | setDocsWithField | If true then GetDocsWithField(AtomicReader, String) will also be computed and stored in the IFieldCache. |
Returns
Type | Description |
---|---|
FieldCache.Int64s | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetInt64s(AtomicReader, String, Boolean)
Returns a FieldCache.Int64s over the values found in documents in the given field.
NOTE: this was getLongs() in Lucene
Declaration
FieldCache.Int64s GetInt64s(AtomicReader reader, string field, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | |
System.String | field | |
System.Boolean | setDocsWithField |
Returns
Type | Description |
---|---|
FieldCache.Int64s |
See Also
| Improve this Doc View SourceGetSingles(AtomicReader, String, FieldCache.ISingleParser, Boolean)
Returns a FieldCache.Singles over the values found in documents in the given
field. If the field was indexed as NumericDocValuesField, it simply
uses GetNumericDocValues(String) to read the values.
Otherwise, it checks the internal cache for an appropriate entry, and if
none is found, reads the terms in field
as System.Singles and returns
an array of size reader.MaxDoc
of the value each document
has in the given field.
NOTE: this was getFloats() in Lucene
Declaration
FieldCache.Singles GetSingles(AtomicReader reader, string field, FieldCache.ISingleParser parser, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the System.Singles. |
FieldCache.ISingleParser | parser | Computes System.Single for string values. May be |
System.Boolean | setDocsWithField | If true then GetDocsWithField(AtomicReader, String) will also be computed and stored in the IFieldCache. |
Returns
Type | Description |
---|---|
FieldCache.Singles | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetSingles(AtomicReader, String, Boolean)
Returns a FieldCache.Singles over the values found in documents in the given field.
NOTE: this was getFloats() in Lucene
Declaration
FieldCache.Singles GetSingles(AtomicReader reader, string field, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | |
System.String | field | |
System.Boolean | setDocsWithField |
Returns
Type | Description |
---|---|
FieldCache.Singles |
See Also
| Improve this Doc View SourceGetTerms(AtomicReader, String, Boolean)
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.
Declaration
BinaryDocValues GetTerms(AtomicReader reader, string field, bool setDocsWithField)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the strings. |
System.Boolean | setDocsWithField | If true then GetDocsWithField(AtomicReader, String) will also be computed and stored in the IFieldCache. |
Returns
Type | Description |
---|---|
BinaryDocValues | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetTerms(AtomicReader, String, Boolean, Single)
Expert: just like GetTerms(AtomicReader, 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.
Declaration
BinaryDocValues GetTerms(AtomicReader reader, string field, bool setDocsWithField, float acceptableOverheadRatio)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | |
System.String | field | |
System.Boolean | setDocsWithField | |
System.Single | acceptableOverheadRatio |
Returns
Type | Description |
---|---|
BinaryDocValues |
GetTermsIndex(AtomicReader, String)
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 BytesRef) per document.
Declaration
SortedDocValues GetTermsIndex(AtomicReader reader, string field)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | Used to get field values. |
System.String | field | Which field contains the strings. |
Returns
Type | Description |
---|---|
SortedDocValues | The values in the given field for each document. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | If any error occurs. |
GetTermsIndex(AtomicReader, String, Single)
Expert: just like GetTermsIndex(AtomicReader, 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.
Declaration
SortedDocValues GetTermsIndex(AtomicReader reader, string field, float acceptableOverheadRatio)
Parameters
Type | Name | Description |
---|---|---|
AtomicReader | reader | |
System.String | field | |
System.Single | acceptableOverheadRatio |
Returns
Type | Description |
---|---|
SortedDocValues |
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 System.WeakReferences). It should not be relied on for "Cache maintenance" in general application code.
Declaration
void PurgeAllCaches()
PurgeByCacheKey(Object)
Expert: drops all cache entries associated with this reader CoreCacheKey. 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.
Declaration
void PurgeByCacheKey(object coreCacheKey)
Parameters
Type | Name | Description |
---|---|---|
System.Object | coreCacheKey |