org.hibernate.search.filter.impl

## Class CachingWrapperQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.hibernate.search.filter.impl.CachingWrapperQuery

- All Implemented Interfaces:
    Cloneable

      public class CachingWrapperQuery
      extends Query
      implements Cloneable

  A slightly different version of Lucene's original `CachingWrapperQuery` which uses `SoftReferences` instead of `WeakReferences` in order to cache the filter `DocIdSet`.
  Author:
    Hardy Ferentschik, Sanne Grinovero
  See Also:
    `CachingWrapperQuery`, HSEARCH-174

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CachingWrapperQuery(Query query)`
    `CachingWrapperQuery(Query query, int size)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected DocIdSet` | `cacheImpl(DocIdSetIterator iterator, LeafReader reader)` Default cache implementation: uses `RoaringDocIdSet`.
    `Weight` | `createWeight(IndexSearcher searcher, boolean needsScores)`
    `boolean` | `equals(Object o)`
    `Query` | `getQuery()` Gets the contained query.
    `int` | `hashCode()`
    `Query` | `rewrite(IndexReader reader)`
    `String` | `toString(String field)`

    - ### 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`

- - ### Field Detail

    - #### DEFAULT_SIZE

          public static final int DEFAULT_SIZE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CachingWrapperQuery

          public CachingWrapperQuery(Query query)

      Parameters:
        `query` - Query to cache results of

    - #### CachingWrapperQuery

          public CachingWrapperQuery(Query query,
                                     int size)

      Parameters:
        `query` - Query to cache results of
        `size` - soft reference size (gets multiplied by `HARD_TO_SOFT_RATIO`.

  - ### Method Detail

    - #### getQuery

          public Query getQuery()

      Gets the contained query.
      Returns:
        the contained query.

    - #### cacheImpl

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

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

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws IOException

      Overrides:
        `rewrite` in class `Query`
      Throws:
        `IOException`

    - #### createWeight

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

      Overrides:
        `createWeight` in class `Query`
      Throws:
        `IOException`

    - #### toString

          public String toString(String field)

      Specified by:
        `toString` in class `Query`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Query`

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved