Class TreeFilter
A tree filter that accepts everything is created at the root of tree-like mapping structures (e.g. a Pojo mapping).
Then, each time specific nesting features (e.g. index embedding with @IndexedEmbedded) are used,
another filter is created with the constraints defined through that feature
(e.g. @IndexedEmbedded(includePaths = ...)).
Filter usage in index schemas
A tree filter is asked to provide advice about whether to trim down the index schema in two cases:
- When a field is added by a bridge, the filter decides whether to include this field or not
through its
isPathIncluded(String)method - When a nested filter (e.g.
@IndexedEmbedded) is requested, a new filter is created through thecompose(MappingElement, String, TreeFilterDefinition, TreeFilterPathTracker, BiFunction)method, which may return an empty optional, meaning that the nested filterexcludes every path.
Filter properties
A tree filter decides whether to include a path or not according to its two main properties:
- the
depth filter - the
path filter
The path filter, as its name suggests, define which paths should be explicitly included or excluded by this filter.
The depth filter defines how paths that are not explicitly included or excluded by the path filter should be treated:
- as long as the remaining depth is unlimited (null) or strictly positive, paths are included by default
- as soon as the remaining depth is zero or negative, paths are excluded by default
Filter composition
Composed filters are created whenever a nested filter (e.g. @IndexedEmbedded) is encountered.
A composed filter will always enforce the restrictions of its parent filter,
plus some added restrictions depending on the properties of the nested filter.
For more information about how filters are composed, see
compose(MappingElement, String, TreeFilterDefinition, TreeFilterPathTracker, BiFunction).
-
Method Summary
Modifier and TypeMethodDescriptioncompose(MappingElement mappingElement, String relativePrefix, TreeFilterDefinition definition, TreeFilterPathTracker pathTracker, BiFunction<MappingElement, String, SearchException> cyclicRecursionExceptionFactory) booleanbooleanisPathIncluded(String relativePath) static TreeFilterroot()toString()
-
Method Details
-
root
-
toString
-
isPathIncluded
-
isEveryPathExcluded
public boolean isEveryPathExcluded() -
compose
public TreeFilter compose(MappingElement mappingElement, String relativePrefix, TreeFilterDefinition definition, TreeFilterPathTracker pathTracker, BiFunction<MappingElement, String, SearchException> cyclicRecursionExceptionFactory)
-