private void applyExpressionFilter(final AdvancedDocumentFindRequest request,
                                       final TreeConsumer consumer) {
        final LocalMetrics metrics = SimpleMetrics.createLocalMetrics(LOGGER.isDebugEnabled());
        try {
            if (!ExpressionUtil.hasTerms(request.getExpression())) {
                return;
            }

            // Get a copy of the master tree model, so we can add the favourites into it.
            final TreeModel masterTreeModelClone = explorerTreeModel.getModel().createMutableCopy();

            // This is not used by the explorer tree so, we only want nodes under the System root,
            // not Favourites.
            final ExplorerTreeFilter explorerTreeFilter = ExplorerTreeFilter
                    .builder()
                    .requiredPermissions(request.getRequiredPermissions())
                    .includedRootTypes(ExplorerConstants.SYSTEM_TYPE)
                    .build();

            final FetchExplorerNodeResult result = getData(
                    explorerTreeFilter,
                    masterTreeModelClone,
                    OpenItemsImpl.all(),
                    metrics,
                    false);

            final ExpressionOperator expression = request.getExpression();
            final ExpressionMatcher expressionMatcher =
                    new ExpressionMatcher(DocumentPermissionFields.getAllFieldMap());

            walkNodeTree(result.getRootNodes(), (path, node) -> {
                if (matchExpression(path, node, expressionMatcher, expression)) {
                    return consumer.consume(path, node);
                }
                return true;
            });
        } catch (Exception e) {
            LOGGER.error("Error finding nodes with request {}", request, e);
            throw e;
        }
    }
Create a map of folders and their child items.
stroom-explorer/stroom-explorer-impl/src/main/java/stroom/explorer/impl/ExplorerServiceImpl.java