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, 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 booleancontainsNativeConstraint()Whether the filter contains a native condition.List<String>getFulltextConditions()Get the fulltext search conditions, if any.FullTextExpressiongetFullTextConstraint()Get the fulltext search condition expression, if any.@NotNull Set<String>getMixinTypes()Returns the names of all matching mixin node types.@Nullable StringgetNodeType()Returns the name of the filter node type.StringgetPath()Get the path.StringgetPathPlan()Get the plan for the path.Filter.PathRestrictiongetPathRestriction()Get the path restriction type.@NotNull Set<String>getPrimaryTypes()Returns the names of all matching primary node types.Filter.PropertyRestrictiongetPropertyRestriction(String propertyName)Get the most restrictive property restriction for the given property, if any.Collection<Filter.PropertyRestriction>getPropertyRestrictions()Get the list of property restrictions, if any.List<Filter.PropertyRestriction>getPropertyRestrictions(String propertyName)Get the all property restriction for the given property.QueryLimitsgetQueryLimits()@Nullable StringgetQueryStatement()Get the complete query statement.SelectorImplgetSelector()@NotNull Set<String>getSupertypes()Returns the names of the filter node type and all its supertypes.booleanisAccessible(String path)check whether a certain (valid) path is accessible (can be read) from the user associated with the query SessionbooleanisAlwaysFalse()If the filter condition can not possibly match any row, due to a contradiction in the query (for example "x=1 and x=2").booleanisDistinct()booleanisInferenceEnabled()booleanisPrepared(SelectorImpl selector)Whether the given selector is already prepared during the prepare phase of a join.booleanisPreparing()booleanmatchesAllTypes()Checks whether nodes of all types can match this filter.static FilterImplnewTestInstance()Create a new filter instance that is used for unit testing.voidrestrictFulltextCondition(String condition)voidrestrictPath(String addedPath, Filter.PathRestriction addedPathRestriction)voidrestrictProperty(String propertyName, Operator op, PropertyValue v)voidrestrictProperty(String propertyName, Operator op, PropertyValue v, int propertyType)voidrestrictPropertyAsList(String propertyName, List<PropertyValue> list)voidsetAlwaysFalse()voidsetDistinct(boolean distinct)voidsetFullTextConstraint(FullTextExpression constraint)voidsetMatchesAllTypes(boolean matchesAllTypes)voidsetPath(String path)voidsetPreparing(boolean preparing)booleantestPath(String path)StringtoString()
-
-
-
Constructor Detail
-
FilterImpl
public FilterImpl(SelectorImpl selector, 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 String getPath()
Get the path.
-
getPathRestriction
public Filter.PathRestriction getPathRestriction()
Description copied from interface:FilterGet the path restriction type.- Specified by:
getPathRestrictionin interfaceFilter- Returns:
- the path restriction type
-
getPathPlan
public String getPathPlan()
Description copied from interface:FilterGet the plan for the path.- Specified by:
getPathPlanin interfaceFilter- Returns:
- the plan
-
setPath
public void setPath(String path)
-
isDistinct
public boolean isDistinct()
-
setDistinct
public void setDistinct(boolean distinct)
-
setAlwaysFalse
public void setAlwaysFalse()
-
isAlwaysFalse
public boolean isAlwaysFalse()
Description copied from interface:FilterIf 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:
isAlwaysFalsein interfaceFilter- Returns:
- true if the filter condition can not match any row
-
isInferenceEnabled
public boolean isInferenceEnabled()
- Specified by:
isInferenceEnabledin interfaceFilter- Returns:
- true if inference is enabled.
-
getSelector
public SelectorImpl getSelector()
-
getNodeType
@Nullable public @Nullable String getNodeType()
Description copied from interface:FilterReturns the name of the filter node type.- Specified by:
getNodeTypein interfaceFilter- Returns:
- nodetype name
-
matchesAllTypes
public boolean matchesAllTypes()
Description copied from interface:FilterChecks whether nodes of all types can match this filter.- Specified by:
matchesAllTypesin interfaceFilter- Returns:
trueiff there are no type restrictions
-
getSupertypes
@NotNull public @NotNull Set<String> getSupertypes()
Description copied from interface:FilterReturns the names of the filter node type and all its supertypes.- Specified by:
getSupertypesin interfaceFilter- Returns:
- supertype name
-
getPrimaryTypes
@NotNull public @NotNull Set<String> getPrimaryTypes()
Description copied from interface:FilterReturns the names of all matching primary node types.- Specified by:
getPrimaryTypesin interfaceFilter- Returns:
- primary node type names
-
getMixinTypes
@NotNull public @NotNull Set<String> getMixinTypes()
Description copied from interface:FilterReturns the names of all matching mixin node types.- Specified by:
getMixinTypesin interfaceFilter- Returns:
- mixin node type names
-
getPropertyRestrictions
public Collection<Filter.PropertyRestriction> getPropertyRestrictions()
Description copied from interface:FilterGet 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:
getPropertyRestrictionsin interfaceFilter- Returns:
- the conditions (an empty collection if not used)
-
getPropertyRestriction
public Filter.PropertyRestriction getPropertyRestriction(String propertyName)
Description copied from interface:FilterGet the most restrictive property restriction for the given property, if any.- Specified by:
getPropertyRestrictionin interfaceFilter- Parameters:
propertyName- the property name- Returns:
- the first restriction, or null if there is no restriction for this property
-
testPath
public boolean testPath(String path)
-
restrictPropertyAsList
public void restrictPropertyAsList(String propertyName, List<PropertyValue> list)
-
restrictProperty
public void restrictProperty(String propertyName, Operator op, PropertyValue v)
-
restrictProperty
public void restrictProperty(String propertyName, Operator op, PropertyValue v, int propertyType)
-
getPropertyRestrictions
public List<Filter.PropertyRestriction> getPropertyRestrictions(String propertyName)
Description copied from interface:FilterGet the all property restriction for the given property.- Specified by:
getPropertyRestrictionsin interfaceFilter- Parameters:
propertyName- the property name- Returns:
- the list of restrictions (possibly empty, never null)
-
restrictPath
public void restrictPath(String addedPath, Filter.PathRestriction addedPathRestriction)
-
getFulltextConditions
public List<String> getFulltextConditions()
Description copied from interface:FilterGet the fulltext search conditions, if any.- Specified by:
getFulltextConditionsin interfaceFilter- Returns:
- the conditions (an empty collection if not used)
-
restrictFulltextCondition
public void restrictFulltextCondition(String condition)
-
setFullTextConstraint
public void setFullTextConstraint(FullTextExpression constraint)
-
getFullTextConstraint
public FullTextExpression getFullTextConstraint()
Description copied from interface:FilterGet the fulltext search condition expression, if any.- Specified by:
getFullTextConstraintin interfaceFilter- Returns:
- the condition (null if none)
-
containsNativeConstraint
public boolean containsNativeConstraint()
Description copied from interface:FilterWhether the filter contains a native condition.- Specified by:
containsNativeConstraintin interfaceFilter- Returns:
- true if it does
-
getQueryStatement
@Nullable public @Nullable String getQueryStatement()
Description copied from interface:FilterGet the complete query statement. The statement should only be used for logging purposes.- Specified by:
getQueryStatementin interfaceFilter- Returns:
- the query statement (possibly null)
-
setMatchesAllTypes
public void setMatchesAllTypes(boolean matchesAllTypes)
-
getQueryLimits
public QueryLimits getQueryLimits()
- Specified by:
getQueryLimitsin interfaceFilter
-
isAccessible
public boolean isAccessible(String path)
Description copied from interface:Filtercheck whether a certain (valid) path is accessible (can be read) from the user associated with the query Session- Specified by:
isAccessiblein interfaceFilter- Parameters:
path- a valid JCR path- Returns:
trueif path can be read by the calling user,falseotherwise.
-
-