Class FilterImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.query.index.FilterImpl
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jackrabbit.oak.spi.query.Filter
Filter.PathRestriction, Filter.PropertyRestriction
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.oak.spi.query.Filter
EMPTY_FILTER
-
-
Constructor Summary
Constructors Constructor Description FilterImpl(SelectorImpl selector, java.lang.String queryStatement, QueryLimits settings)
Create a filter.FilterImpl(Filter filter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsNativeConstraint()
Whether the filter contains a native condition.java.util.List<java.lang.String>
getFulltextConditions()
Get the fulltext search conditions, if any.FullTextExpression
getFullTextConstraint()
Get the fulltext search condition expression, if any.@NotNull java.util.Set<java.lang.String>
getMixinTypes()
Returns the names of all matching mixin node types.@Nullable java.lang.String
getNodeType()
Returns the name of the filter node type.java.lang.String
getPath()
Get the path.java.lang.String
getPathPlan()
Get the plan for the path.Filter.PathRestriction
getPathRestriction()
Get the path restriction type.@NotNull java.util.Set<java.lang.String>
getPrimaryTypes()
Returns the names of all matching primary node types.Filter.PropertyRestriction
getPropertyRestriction(java.lang.String propertyName)
Get the most restrictive property restriction for the given property, if any.java.util.Collection<Filter.PropertyRestriction>
getPropertyRestrictions()
Get the list of property restrictions, if any.java.util.List<Filter.PropertyRestriction>
getPropertyRestrictions(java.lang.String propertyName)
Get the all property restriction for the given property.QueryLimits
getQueryLimits()
@Nullable java.lang.String
getQueryStatement()
Get the complete query statement.SelectorImpl
getSelector()
@NotNull java.util.Set<java.lang.String>
getSupertypes()
Returns the names of the filter node type and all its supertypes.boolean
isAccessible(java.lang.String path)
check whether a certain (valid) path is accessible (can be read) from the user associated with the query Sessionboolean
isAlwaysFalse()
If the filter condition can not possibly match any row, due to a contradiction in the query (for example "x=1 and x=2").boolean
isDistinct()
boolean
isPrepared(SelectorImpl selector)
Whether the given selector is already prepared during the prepare phase of a join.boolean
isPreparing()
boolean
matchesAllTypes()
Checks whether nodes of all types can match this filter.static FilterImpl
newTestInstance()
Create a new filter instance that is used for unit testing.void
restrictFulltextCondition(java.lang.String condition)
void
restrictPath(java.lang.String addedPath, Filter.PathRestriction addedPathRestriction)
void
restrictProperty(java.lang.String propertyName, Operator op, PropertyValue v)
void
restrictProperty(java.lang.String propertyName, Operator op, PropertyValue v, int propertyType)
void
restrictPropertyAsList(java.lang.String propertyName, java.util.List<PropertyValue> list)
void
setAlwaysFalse()
void
setDistinct(boolean distinct)
void
setFullTextConstraint(FullTextExpression constraint)
void
setMatchesAllTypes(boolean matchesAllTypes)
void
setPath(java.lang.String path)
void
setPreparing(boolean preparing)
boolean
testPath(java.lang.String path)
java.lang.String
toString()
-
-
-
Constructor Detail
-
FilterImpl
public FilterImpl(SelectorImpl selector, java.lang.String queryStatement, QueryLimits settings)
Create a filter.- Parameters:
selector
- the selector for the given filterqueryStatement
- the query statement
-
FilterImpl
public FilterImpl(Filter filter)
-
-
Method Detail
-
newTestInstance
public static FilterImpl newTestInstance()
Create a new filter instance that is used for unit testing. This method is relatively slow, because it creates a new query engine setting object. Therefore, it is only to be used for testing. At runtime, the public constructor should be used instead.- Returns:
- the filter
-
setPreparing
public void setPreparing(boolean preparing)
-
isPreparing
public boolean isPreparing()
-
isPrepared
public boolean isPrepared(SelectorImpl selector)
Whether the given selector is already prepared during the prepare phase of a join. That means, check whether the passed selector can already provide data.- Parameters:
selector
- the selector to test- Returns:
- true if it is already prepared
-
getPath
public java.lang.String getPath()
Get the path.
-
getPathRestriction
public Filter.PathRestriction getPathRestriction()
Description copied from interface:Filter
Get the path restriction type.- Specified by:
getPathRestriction
in interfaceFilter
- Returns:
- the path restriction type
-
getPathPlan
public java.lang.String getPathPlan()
Description copied from interface:Filter
Get the plan for the path.- Specified by:
getPathPlan
in interfaceFilter
- Returns:
- the plan
-
setPath
public void setPath(java.lang.String path)
-
isDistinct
public boolean isDistinct()
-
setDistinct
public void setDistinct(boolean distinct)
-
setAlwaysFalse
public void setAlwaysFalse()
-
isAlwaysFalse
public boolean isAlwaysFalse()
Description copied from interface:Filter
If the filter condition can not possibly match any row, due to a contradiction in the query (for example "x=1 and x=2").- Specified by:
isAlwaysFalse
in interfaceFilter
- Returns:
- true if the filter condition can not match any row
-
getSelector
public SelectorImpl getSelector()
-
getNodeType
@Nullable public @Nullable java.lang.String getNodeType()
Description copied from interface:Filter
Returns the name of the filter node type.- Specified by:
getNodeType
in interfaceFilter
- Returns:
- nodetype name
-
matchesAllTypes
public boolean matchesAllTypes()
Description copied from interface:Filter
Checks whether nodes of all types can match this filter.- Specified by:
matchesAllTypes
in interfaceFilter
- Returns:
true
iff there are no type restrictions
-
getSupertypes
@NotNull public @NotNull java.util.Set<java.lang.String> getSupertypes()
Description copied from interface:Filter
Returns the names of the filter node type and all its supertypes.- Specified by:
getSupertypes
in interfaceFilter
- Returns:
- supertype name
-
getPrimaryTypes
@NotNull public @NotNull java.util.Set<java.lang.String> getPrimaryTypes()
Description copied from interface:Filter
Returns the names of all matching primary node types.- Specified by:
getPrimaryTypes
in interfaceFilter
- Returns:
- primary node type names
-
getMixinTypes
@NotNull public @NotNull java.util.Set<java.lang.String> getMixinTypes()
Description copied from interface:Filter
Returns the names of all matching mixin node types.- Specified by:
getMixinTypes
in interfaceFilter
- Returns:
- mixin node type names
-
getPropertyRestrictions
public java.util.Collection<Filter.PropertyRestriction> getPropertyRestrictions()
Description copied from interface:Filter
Get the list of property restrictions, if any. Each property may contain multiple restrictions, for example x=1 and x=2. For this case, only multi-valued properties match that contain both 1 and 2.- Specified by:
getPropertyRestrictions
in interfaceFilter
- Returns:
- the conditions (an empty collection if not used)
-
getPropertyRestriction
public Filter.PropertyRestriction getPropertyRestriction(java.lang.String propertyName)
Description copied from interface:Filter
Get the most restrictive property restriction for the given property, if any.- Specified by:
getPropertyRestriction
in interfaceFilter
- Parameters:
propertyName
- the property name- Returns:
- the first restriction, or null if there is no restriction for this property
-
testPath
public boolean testPath(java.lang.String path)
-
restrictPropertyAsList
public void restrictPropertyAsList(java.lang.String propertyName, java.util.List<PropertyValue> list)
-
restrictProperty
public void restrictProperty(java.lang.String propertyName, Operator op, PropertyValue v)
-
restrictProperty
public void restrictProperty(java.lang.String propertyName, Operator op, PropertyValue v, int propertyType)
-
getPropertyRestrictions
public java.util.List<Filter.PropertyRestriction> getPropertyRestrictions(java.lang.String propertyName)
Description copied from interface:Filter
Get the all property restriction for the given property.- Specified by:
getPropertyRestrictions
in interfaceFilter
- Parameters:
propertyName
- the property name- Returns:
- the list of restrictions (possibly empty, never null)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
restrictPath
public void restrictPath(java.lang.String addedPath, Filter.PathRestriction addedPathRestriction)
-
getFulltextConditions
public java.util.List<java.lang.String> getFulltextConditions()
Description copied from interface:Filter
Get the fulltext search conditions, if any.- Specified by:
getFulltextConditions
in interfaceFilter
- Returns:
- the conditions (an empty collection if not used)
-
restrictFulltextCondition
public void restrictFulltextCondition(java.lang.String condition)
-
setFullTextConstraint
public void setFullTextConstraint(FullTextExpression constraint)
-
getFullTextConstraint
public FullTextExpression getFullTextConstraint()
Description copied from interface:Filter
Get the fulltext search condition expression, if any.- Specified by:
getFullTextConstraint
in interfaceFilter
- Returns:
- the condition (null if none)
-
containsNativeConstraint
public boolean containsNativeConstraint()
Description copied from interface:Filter
Whether the filter contains a native condition.- Specified by:
containsNativeConstraint
in interfaceFilter
- Returns:
- true if it does
-
getQueryStatement
@Nullable public @Nullable java.lang.String getQueryStatement()
Description copied from interface:Filter
Get the complete query statement. The statement should only be used for logging purposes.- Specified by:
getQueryStatement
in interfaceFilter
- Returns:
- the query statement (possibly null)
-
setMatchesAllTypes
public void setMatchesAllTypes(boolean matchesAllTypes)
-
getQueryLimits
public QueryLimits getQueryLimits()
- Specified by:
getQueryLimits
in interfaceFilter
-
isAccessible
public boolean isAccessible(java.lang.String path)
Description copied from interface:Filter
check whether a certain (valid) path is accessible (can be read) from the user associated with the query Session- Specified by:
isAccessible
in interfaceFilter
- Parameters:
path
- a valid JCR path- Returns:
true
if path can be read by the calling user,false
otherwise.
-
-