Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.queryparser.xml.builders
Class CachedFilterBuilder

    java.lang.Object
      org.apache.lucene.queryparser.xml.builders.CachedFilterBuilder

All Implemented Interfaces:
  FilterBuilder

    public class CachedFilterBuilder

extends Object
implements FilterBuilder

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.

Constructor Summary
`CachedFilterBuilder(QueryBuilderFactory queryFactory, FilterBuilderFactory filterFactory, int cacheSize)`

Method Summary
`Filter` | `getFilter(Element e)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CachedFilterBuilder

    public CachedFilterBuilder(QueryBuilderFactory queryFactory,
                               FilterBuilderFactory filterFactory,
                               int cacheSize)

Method Detail

### getFilter

    public Filter getFilter(Element e)
                     throws ParserException

  Specified by:
    `getFilter` in interface `FilterBuilder`
  Throws:
    `ParserException`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.