Package com.onwbp.adaptation

# Interface PrefilteredAdaptationFilter

All Superinterfaces:
  `AdaptationFilter`

All Known Implementing Classes:
  `AbstractPrefilteredAdaptationFilter`

public interface PrefilteredAdaptationFilter extends AdaptationFilter
Defines an `AdaptationFilter` that can be optimized using a prefilter predicate.

A prefilter is an XPath filter used by the query framework to filter records without the need of calling `AdaptationFilter.accept(Adaptation)`. This allows to avoid evaluating the programmatic filter by using, e.g., index scans.

Since:
  6.2.1
See Also:
  - `AbstractPrefilteredAdaptationFilter`
  - `TableRefFilterContext.setPrefilter(String)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static PrefilteredAdaptationFilter`
  `create(XPathFilter prefilter, AdaptationFilter filter)`
  Creates a `PrefilteredAdaptationFilter` based on `AbstractPrefilteredAdaptationFilter`.
  `XPathFilter`
  `getPrefilter()`
  Defines the prefilter.

  ### Methods inherited from interface com.onwbp.adaptation.AdaptationFilter

  `accept`

- ## Method Details

  - ### getPrefilter

    XPathFilter getPrefilter()
    Defines the prefilter. This method must always return the same filter for an instance of this interface.

    The prefilter

    - must be consistent with `AdaptationFilter.accept(Adaptation)`, i.e., it must evaluate to true for all records where the `accept` method returns `true`.
    - may not use parameters.
    - should be selective, i.e., it should evaluate to true only for a relatively small part of the records of the table where the filter is applied on.
    - should be "index-friendly" for best performance, i.e., it should be evaluated using indexes only. This can be checked by activating the debug level of the request log and executing a the request that uses the AdaptationFilter (see `Request.setSpecificFilter(AdaptationFilter)`). The logged physical plan should have a Lucene scan operation with a filter corresponding to the specified prefilter.

  - ### create

    static PrefilteredAdaptationFilter create(XPathFilter prefilter, AdaptationFilter filter)
    Creates a `PrefilteredAdaptationFilter` based on `AbstractPrefilteredAdaptationFilter`.