Class TreeFilter


  • public class TreeFilter
    extends Object
    A tree filter, responsible for deciding which parts of a (potentially cyclic) graph will be retained as a tree, e.g. in an index schema.

    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:

    Filter properties

    A tree filter decides whether to include a path or not according to its two main properties:

    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).