Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Interface IFieldCache

    Expert: Maintains caches of term values.

    Created: May 19, 2004 11:13:14 AM

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    @since lucene 1.4
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public interface IFieldCache

    Properties

    InfoStream

    If non-null, FieldCacheImpl will warn whenever entries are created that are not sane according to FieldCacheSanityChecker.

    Declaration
    TextWriter InfoStream { get; set; }
    Property Value
    Type Description
    TextWriter
    See Also
    FieldCacheSanityChecker

    Methods

    GetBytes(AtomicReader, string, IByteParser, bool)

    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.

    string field

    Which field contains the bytes.

    FieldCache.IByteParser parser

    Computes byte for string values.

    bool 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
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    GetBytes(AtomicReader, string, bool)

    Checks the internal cache for an appropriate entry, and if none is found, reads the terms in field as a single 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.

    string field

    Which field contains the single byte values.

    bool 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
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    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 WeakReference.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Declaration
    FieldCache.CacheEntry[] GetCacheEntries()
    Returns
    Type Description
    CacheEntry[]
    See Also
    FieldCacheSanityChecker

    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

    string field

    Which field contains the strings.

    Returns
    Type Description
    SortedSetDocValues

    a SortedSetDocValues instance

    Exceptions
    Type Condition
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    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
    string field
    Returns
    Type Description
    IBits
    See Also
    FieldCacheSanityChecker

    GetDoubles(AtomicReader, string, IDoubleParser, bool)

    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 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.

    string field

    Which field contains the doubles.

    FieldCache.IDoubleParser parser

    Computes double for string values. May be null if the requested field was indexed as NumericDocValuesField or DoubleField.

    bool 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
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    GetDoubles(AtomicReader, string, bool)

    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
    string field
    bool setDocsWithField
    Returns
    Type Description
    FieldCache.Doubles
    See Also
    GetDoubles(AtomicReader, string, IDoubleParser, bool)

    GetInt16s(AtomicReader, string, IInt16Parser, bool)

    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.

    string field

    Which field contains the shorts.

    FieldCache.IInt16Parser parser

    Computes short for string values.

    bool 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
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    GetInt16s(AtomicReader, string, bool)

    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, bool setDocsWithField)
    Parameters
    Type Name Description
    AtomicReader reader

    Used to get field values.

    string field

    Which field contains the shorts.

    bool 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
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    GetInt32s(AtomicReader, string, IInt32Parser, bool)

    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 ints 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.

    string field

    Which field contains the ints.

    FieldCache.IInt32Parser parser

    Computes int for string values. May be null if the requested field was indexed as NumericDocValuesField or Int32Field.

    bool 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
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    GetInt32s(AtomicReader, string, bool)

    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
    string field
    bool setDocsWithField
    Returns
    Type Description
    FieldCache.Int32s
    See Also
    GetInt32s(AtomicReader, string, IInt32Parser, bool)

    GetInt64s(AtomicReader, string, IInt64Parser, bool)

    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 longs 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.

    string field

    Which field contains the longs.

    FieldCache.IInt64Parser parser

    Computes long for string values. May be null if the requested field was indexed as NumericDocValuesField or Int64Field.

    bool 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
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    GetInt64s(AtomicReader, string, bool)

    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
    string field
    bool setDocsWithField
    Returns
    Type Description
    FieldCache.Int64s
    See Also
    GetInt64s(AtomicReader, string, IInt64Parser, bool)

    GetSingles(AtomicReader, string, ISingleParser, bool)

    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 floats 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.

    string field

    Which field contains the floats.

    FieldCache.ISingleParser parser

    Computes float for string values. May be null if the requested field was indexed as NumericDocValuesField or SingleField.

    bool 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
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    GetSingles(AtomicReader, string, bool)

    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
    string field
    bool setDocsWithField
    Returns
    Type Description
    FieldCache.Singles
    See Also
    GetSingles(AtomicReader, string, ISingleParser, bool)

    GetTerms(AtomicReader, string, bool)

    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.

    string field

    Which field contains the strings.

    bool 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
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    GetTerms(AtomicReader, string, bool, float)

    Expert: just like GetTerms(AtomicReader, string, bool), 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
    string field
    bool setDocsWithField
    float acceptableOverheadRatio
    Returns
    Type Description
    BinaryDocValues
    See Also
    FieldCacheSanityChecker

    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.

    string field

    Which field contains the strings.

    Returns
    Type Description
    SortedDocValues

    The values in the given field for each document.

    Exceptions
    Type Condition
    IOException

    If any error occurs.

    See Also
    FieldCacheSanityChecker

    GetTermsIndex(AtomicReader, string, float)

    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
    string field
    float acceptableOverheadRatio
    Returns
    Type Description
    SortedDocValues
    See Also
    FieldCacheSanityChecker

    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.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Declaration
    void PurgeAllCaches()
    See Also
    FieldCacheSanityChecker

    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
    object coreCacheKey
    See Also
    FieldCacheSanityChecker

    See Also

    FieldCacheSanityChecker
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.