Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class CachingWrapperFilter

    Wraps another Filter's result and caches it. The purpose is to allow filters to simply filter, and then wrap with this class to add caching.

    Inheritance
    object
    Filter
    CachingWrapperFilter
    Inherited Members
    Filter.NewAnonymous(Func<AtomicReaderContext, IBits, DocIdSet>)
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public class CachingWrapperFilter : Filter

    Constructors

    CachingWrapperFilter(Filter)

    Wraps another filter's result and caches it.

    Declaration
    public CachingWrapperFilter(Filter filter)
    Parameters
    Type Name Description
    Filter filter

    Filter to cache results of

    Fields

    EMPTY_DOCIDSET

    An empty DocIdSet instance

    Declaration
    protected static readonly DocIdSet EMPTY_DOCIDSET
    Field Value
    Type Description
    DocIdSet

    Properties

    Filter

    Gets the contained filter.

    Declaration
    public virtual Filter Filter { get; }
    Property Value
    Type Description
    Filter

    the contained filter.

    Methods

    CacheImpl(DocIdSetIterator, AtomicReader)

    Default cache implementation: uses WAH8DocIdSet.

    Declaration
    protected virtual DocIdSet CacheImpl(DocIdSetIterator iterator, AtomicReader reader)
    Parameters
    Type Name Description
    DocIdSetIterator iterator
    AtomicReader reader
    Returns
    Type Description
    DocIdSet

    DocIdSetToCache(DocIdSet, AtomicReader)

    Provide the DocIdSet to be cached, using the DocIdSet provided by the wrapped Filter.

    This implementation returns the given DocIdSet, if IsCacheable returns true, else it calls CacheImpl(DocIdSetIterator, AtomicReader)

    Note: this method returns EMPTY_DOCIDSET if the given docIdSet is null or if GetIterator() return null. The empty instance is use as a placeholder in the cache instead of the null value.
    Declaration
    protected virtual DocIdSet DocIdSetToCache(DocIdSet docIdSet, AtomicReader reader)
    Parameters
    Type Name Description
    DocIdSet docIdSet
    AtomicReader reader
    Returns
    Type Description
    DocIdSet

    Equals(object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object o)
    Parameters
    Type Name Description
    object o
    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)

    GetDocIdSet(AtomicReaderContext, IBits)

    Creates a DocIdSet enumerating the documents that should be permitted in search results. NOTE:null can be returned if no documents are accepted by this Filter.

    Note: this method will be called once per segment in the index during searching. The returned DocIdSet must refer to document IDs for that segment, not for the top-level reader.
    Declaration
    public override DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs)
    Parameters
    Type Name Description
    AtomicReaderContext context

    a AtomicReaderContext instance opened on the index currently searched on. Note, it is likely that the provided reader info does not represent the whole underlying index i.e. if the index has more than one segment the given reader only represents a single segment. The provided context is always an atomic context, so you can call Fields on the context's reader, for example.

    IBits acceptDocs

    IBits that represent the allowable docs to match (typically deleted docs but possibly filtering other documents)

    Returns
    Type Description
    DocIdSet

    A DocIdSet that provides the documents which should be permitted or prohibited in search results. NOTE:null should be returned if the filter doesn't accept any documents otherwise internal optimization might not apply in the case an emptyDocIdSet is returned.

    Overrides
    Filter.GetDocIdSet(AtomicReaderContext, IBits)

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()

    GetSizeInBytes()

    Returns total byte size used by cached filters.

    Declaration
    public virtual long GetSizeInBytes()
    Returns
    Type Description
    long

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()
    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.