org.apache.lucene.search

## Class CachingWrapperQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.search.CachingWrapperQuery

- All Implemented Interfaces:
    Cloneable, Accountable

  Deprecated.
  Use a `QueryCache` instead, such as `LRUQueryCache`.

      @Deprecated
      public class CachingWrapperQuery
      extends Query
      implements Accountable, Cloneable

  Wraps another `Query`'s result and caches it when scores are not needed. The purpose is to allow queries to simply care about matching and scoring, and then wrap with this class to add caching.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CachingWrapperQuery(Query query)` Deprecated. Same as `CachingWrapperQuery(Query, QueryCachingPolicy)` but enforces the use of the `QueryCachingPolicy.CacheOnLargeSegments.DEFAULT` policy.
    `CachingWrapperQuery(Query query, QueryCachingPolicy policy)` Deprecated. Wraps another query's result and caches it according to the provided policy.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected DocIdSet` | `cacheImpl(DocIdSetIterator iterator, LeafReader reader)` Deprecated. Default cache implementation: uses `RoaringDocIdSet`.
    `Weight` | `createWeight(IndexSearcher searcher, boolean needsScores)` Deprecated. Expert: Constructs an appropriate Weight implementation for this query.
    `boolean` | `equals(Object o)` Deprecated.
    `Collection<Accountable>` | `getChildResources()` Deprecated. Returns nested resources of this class.
    `Query` | `getQuery()` Deprecated. Gets the contained query.
    `int` | `hashCode()` Deprecated.
    `long` | `ramBytesUsed()` Deprecated. Return the memory usage of this object in bytes.
    `Query` | `rewrite(IndexReader reader)` Deprecated. Expert: called to re-write queries into primitive queries.
    `String` | `toString(String field)` Deprecated. Prints a query to a string, with `field` assumed to be the default field and omitted.

    - ### Methods inherited from class org.apache.lucene.search.Query

      `clone, getBoost, setBoost, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CachingWrapperQuery

          public CachingWrapperQuery(Query query,
                             QueryCachingPolicy policy)

      Deprecated.
      Wraps another query's result and caches it according to the provided policy.
      Parameters:
        `query` - Query to cache results of
        `policy` - policy defining which filters should be cached on which segments

    - #### CachingWrapperQuery

          public CachingWrapperQuery(Query query)

      Deprecated.
      Same as `CachingWrapperQuery(Query, QueryCachingPolicy)` but enforces the use of the `QueryCachingPolicy.CacheOnLargeSegments.DEFAULT` policy.

  - ### Method Detail

    - #### getQuery

          public Query getQuery()

      Deprecated.
      Gets the contained query.
      Returns:
        the contained query.

    - #### cacheImpl

          protected DocIdSet cacheImpl(DocIdSetIterator iterator,
                           LeafReader reader)
                                throws IOException

      Deprecated.
      Default cache implementation: uses `RoaringDocIdSet`.
      Throws:
        `IOException`

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws IOException

      Deprecated.
      Description copied from class: `Query`
      Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
      Overrides:
        `rewrite` in class `Query`
      Throws:
        `IOException`

    - #### createWeight

          public Weight createWeight(IndexSearcher searcher,
                            boolean needsScores)
                              throws IOException

      Deprecated.
      Description copied from class: `Query`
      Expert: Constructs an appropriate Weight implementation for this query.

      Only implemented by primitive queries, which re-write to themselves.

      Overrides:
        `createWeight` in class `Query`
        `needsScores` - True if document scores (`Scorer.score()`) or match frequencies (`Scorer.freq()`) are needed.
      Throws:
        `IOException`

    - #### toString

          public String toString(String field)

      Deprecated.
      Description copied from class: `Query`
      Prints a query to a string, with `field` assumed to be the default field and omitted.
      Specified by:
        `toString` in class `Query`

    - #### equals

          public boolean equals(Object o)

      Deprecated.
      Overrides:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Deprecated.
      Overrides:
        `hashCode` in class `Query`

    - #### ramBytesUsed

          public long ramBytesUsed()

      Deprecated.
      Description copied from interface: `Accountable`
      Return the memory usage of this object in bytes. Negative values are illegal.
      Specified by:
        `ramBytesUsed` in interface `Accountable`

    - #### getChildResources

          public Collection<Accountable> getChildResources()

      Deprecated.
      Description copied from interface: `Accountable`
      Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).
      Specified by:
        `getChildResources` in interface `Accountable`
      See Also:
        `Accountables`

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