Class AbstractPrefilteredAdaptationFilter
- All Implemented Interfaces:
AdaptationFilter
,PrefilteredAdaptationFilter
PrefilteredAdaptationFilter
.
It ensures that the prefilter is always applied in the AdaptationFilter.accept(Adaptation)
method.
The prefilter does not need to be checked again in the implementation of
acceptPrefilteredRecord(Adaptation)
.
As a consequence, the necessary consistency condition of PrefilteredAdaptationFilter
is always fulfilled.
Warning: this class is not thread-safe, i.e., an instance of a subclass may only be used
by one thread at a time (including the execution in a Request
or calling the methods directly).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
accept
(Adaptation aRecord) Returns whether or not a record is included in the filter result.abstract boolean
acceptPrefilteredRecord
(Adaptation aRecord) Returns whether or not a record is included in the filter result, without taking the prefilter into account.abstract XPathFilter
Defines the prefilter.
-
Constructor Details
-
AbstractPrefilteredAdaptationFilter
public AbstractPrefilteredAdaptationFilter()
-
-
Method Details
-
acceptPrefilteredRecord
Returns whether or not a record is included in the filter result, without taking the prefilter into account.The caller is responsible to ensure that the prefilter is already applied, i.e., this method should only be called for records for which the prefilter evaluates to
true
. The conditions and recommendations of theAdaptationFilter.accept(Adaptation)
method apply here as well.- Parameters:
aRecord
- for filtering, which has already passed the prefilter.- See Also:
-
getPrefilter
Description copied from interface:PrefilteredAdaptationFilter
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 theaccept
method returnstrue
. - 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.
- Specified by:
getPrefilter
in interfacePrefilteredAdaptationFilter
- must be consistent with
-
accept
Description copied from interface:AdaptationFilter
Returns whether or not a record is included in the filter result.No assumptions should be made about the order that the records of the table are evaluated by this method (if
sort criteria
is set, the specified ordering can be applied before or after the evaluation of this filter).When the filter is used on large tables, it is important to implement a low-computation algorithm.
In case of performance problems, a
PrefilteredAdaptationFilter
might give the query optimizer enough information to speed up the queries that use theAdaptationFilter
.- Specified by:
accept
in interfaceAdaptationFilter
- See Also:
-