@Override
    public Set<String> getTags(final Collection<DocRef> docRefs, final TagFetchMode fetchMode) {

        if (NullSafe.hasItems(docRefs)) {
            final UnmodifiableTreeModel treeModel = explorerTreeModel.getModel();
            if (TagFetchMode.OR.equals(fetchMode) || docRefs.size() == 1) {
                return NullSafe.stream(docRefs)
                        .filter(Objects::nonNull)
                        .map(docRef ->
                                treeModel.getNode(docRef.getUuid()))
                        .filter(Objects::nonNull)
                        .flatMap(node ->
                                NullSafe.stream(node.getTags()))
                        .collect(Collectors.toUnmodifiableSet());
            } else {
                // Find the tags common to ALL nodes
                Set<String> commonTags = null;
                for (final DocRef docRef : docRefs) {
                    if (docRef != null) {
                        final ExplorerNode node = treeModel.getNode(docRef.getUuid());
                        final Set<String> nodeTags = new HashSet<>(NullSafe.getOrElseGet(
                                node,
                                ExplorerNode::getTags,
                                Collections::emptySet));
                        if (nodeTags.isEmpty()) {
                            // A node has no tags so no common tags
                            commonTags = nodeTags;
                            break;
                        }
                        if (commonTags != null) {
                            nodeTags.retainAll(commonTags);
                        }
                        commonTags = nodeTags;
                    }
                }
                return Collections.unmodifiableSet(NullSafe.set(commonTags));
            }
        } else {
            return Collections.emptySet();
        }
    }
Create a map of folders and their child items.
stroom-explorer/stroom-explorer-impl/src/main/java/stroom/explorer/impl/ExplorerServiceImpl.java