private Condition isInFolder(final ExpressionTerm term, final DocRef docRef) {
        Condition condition = field.in(Collections.emptyList());

        if (FieldType.DOC_REF.equals(dataSourceField.getFldType())) {
            final String type = dataSourceField.getDocRefType();
            if (type != null && collectionService != null) {
                final Set<DocRef> descendants = collectionService.getDescendants(docRef, type);
                if (descendants != null && !descendants.isEmpty()) {
                    final List<String> values = descendants.stream()
                            .map(descendant ->
                                    getDocValue(term, descendant))
                            .toList();
                    final Set<T> set = new HashSet<>(converter.apply(values));
                    condition = field.in(set);
                }
            }
        }

        return condition;
    }
Get an identifier for the passed docRef. term is only used for logging.
docRef may be the same as term.getDocRef() or a descendant of it, as in 'in folder'.

@return The name of the doc or its uuid depending on how the {@link TermHandler} is
configured.
stroom-db-util/src/main/java/stroom/db/util/TermHandler.java