Class PathIteratorFilter


  • public class PathIteratorFilter
    extends Object
    A utility class that allows skipping nodes that are not included in the index definition. The use case is to speed up indexing by only traversing over the nodes that are included in the set of indexes. The class has an efficient way to get the prefix of the _next_ included path, given a path: nextIncludedPath(). For the root node, we remember that the root node is included. For all other included paths, we internally retain two prefix entries: the entry itself (e.g. /content), and the entry with children (e.g. /content/). This is because the alphabetically sorted list of path does not always go from parent to child. As an example, the entries are sorted like this: - /content - /content-more - /content/child In this case, /content-more is sorted up before the direct children of /content. So the next included path of /content, after /content-more, is /content/.
    • Constructor Detail

      • PathIteratorFilter

        public PathIteratorFilter()
    • Method Detail

      • extractPathFilters

        public static List<PathFilter> extractPathFilters​(Set<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> indexDefs)
        Extract all the path filters from a set of index definitions.
        Parameters:
        indexDefs - the index definitions
        Returns:
        the list of path filters
      • getAllIncludedPaths

        public static SortedSet<String> getAllIncludedPaths​(List<PathFilter> pathFilters)
        Extract a list of included paths from a path filter. Only the top-most entries are retained. Excluded path are ignored.
        Parameters:
        pathFilters - the path filters
        Returns:
        the set of included path, sorted by path
      • includes

        public boolean includes​(String path)
      • nextIncludedPath

        public String nextIncludedPath​(String path)
        Get the next higher included path, or null if none.
        Parameters:
        path - the path
        Returns:
        the next included path, or null