Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class CachedFilterBuilder

    Filters are cached in an LRU Cache keyed on the contained query or filter object. Using this will speed up overall performance for repeated uses of the same expensive query/filter. The sorts of queries/filters likely to benefit from caching need not necessarily be complex - e.g. simple TermQuerys with a large DF (document frequency) can be expensive on large indexes. A good example of this might be a term query on a field with only 2 possible values - "true" or "false". In a large index, querying or filtering on this field requires reading millions of document ids from disk which can more usefully be cached as a filter bitset.

    For Queries/Filters to be cached and reused the object must implement hashcode and equals methods correctly so that duplicate queries/filters can be detected in the cache.

    The CoreParser.maxNumCachedFilters property can be used to control the size of the LRU Cache established during the construction of CoreParser instances.
    Inheritance
    object
    CachedFilterBuilder
    Implements
    IFilterBuilder
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.QueryParsers.Xml.Builders
    Assembly: Lucene.Net.QueryParser.dll
    Syntax
    public class CachedFilterBuilder : IFilterBuilder

    Constructors

    CachedFilterBuilder(QueryBuilderFactory, FilterBuilderFactory, int)

    Filters are cached in an LRU Cache keyed on the contained query or filter object. Using this will speed up overall performance for repeated uses of the same expensive query/filter. The sorts of queries/filters likely to benefit from caching need not necessarily be complex - e.g. simple TermQuerys with a large DF (document frequency) can be expensive on large indexes. A good example of this might be a term query on a field with only 2 possible values - "true" or "false". In a large index, querying or filtering on this field requires reading millions of document ids from disk which can more usefully be cached as a filter bitset.

    For Queries/Filters to be cached and reused the object must implement hashcode and equals methods correctly so that duplicate queries/filters can be detected in the cache.

    The CoreParser.maxNumCachedFilters property can be used to control the size of the LRU Cache established during the construction of CoreParser instances.
    Declaration
    public CachedFilterBuilder(QueryBuilderFactory queryFactory, FilterBuilderFactory filterFactory, int cacheSize)
    Parameters
    Type Name Description
    QueryBuilderFactory queryFactory
    FilterBuilderFactory filterFactory
    int cacheSize

    Methods

    GetFilter(XmlElement)

    Filters are cached in an LRU Cache keyed on the contained query or filter object. Using this will speed up overall performance for repeated uses of the same expensive query/filter. The sorts of queries/filters likely to benefit from caching need not necessarily be complex - e.g. simple TermQuerys with a large DF (document frequency) can be expensive on large indexes. A good example of this might be a term query on a field with only 2 possible values - "true" or "false". In a large index, querying or filtering on this field requires reading millions of document ids from disk which can more usefully be cached as a filter bitset.

    For Queries/Filters to be cached and reused the object must implement hashcode and equals methods correctly so that duplicate queries/filters can be detected in the cache.

    The CoreParser.maxNumCachedFilters property can be used to control the size of the LRU Cache established during the construction of CoreParser instances.
    Declaration
    public virtual Filter GetFilter(XmlElement e)
    Parameters
    Type Name Description
    XmlElement e
    Returns
    Type Description
    Filter

    Implements

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