@Override
    public ResultPage<FindResult> find(final DocumentFindRequest request) {
        final LocalMetrics metrics = SimpleMetrics.createLocalMetrics(LOGGER.isDebugEnabled());
        try {
            if (request.getFilter() == null) {
                return ResultPage.empty();
            }
            final boolean recentItemsMode = request.getFilter().getRecentItems() != null;
            if (recentItemsMode) {
                if (request.getFilter().getRecentItems().isEmpty()) {
                    return ResultPage.empty();
                }
            } else if (NullSafe.isBlankString(request.getFilter().getNameFilter())) {
                return ResultPage.empty();
            }

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

            final FetchExplorerNodeResult result = getData(
                    request.getFilter(),
                    masterTreeModelClone,
                    OpenItemsImpl.all(),
                    metrics,
                    false);
            final List<FindResult> results = new ArrayList<>();

            walkNodeTree(result.getRootNodes(), (path, node) -> {
                if (node.hasNodeFlag(NodeFlag.FILTER_MATCH) &&
                    node.getDocRef() != null &&
                    !ExplorerConstants.isRootNode(node)) {
                    final String pathStr = ExplorerNode.buildDocRefPathString(path);
                    results.add(new FindResult(node.getDocRef(), pathStr));
                }
                return true;
            });

            // If this is recent items mode then filter by recent items.
            if (recentItemsMode) {
                final Map<DocRef, FindResult> resultMap = results
                        .stream()
                        .collect(Collectors.toMap(FindResult::getDocRef, Function.identity()));
                final List<FindResult> recentItems = request
                        .getFilter().getRecentItems()
                        .stream()
                        .map(resultMap::get)
                        .filter(Objects::nonNull)
                        .toList();
                return ResultPage.createPageLimitedList(recentItems, request.getPageRequest());
            } else {
                results.sort(Comparator
                        .<FindResult, String>comparing(res -> res.getDocRef().getName(), Comparator.naturalOrder())
                        .thenComparing(FindResult::getPath)
                        .thenComparing(res -> res.getDocRef().getType())
                        .thenComparing(res -> res.getDocRef().getUuid()));
            }

            return ResultPage.createPageLimitedList(results, request.getPageRequest());

        } 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