private String getDocValue(final ExpressionTerm term, final DocRef docRef) {
        if (useName) {
            if (docRefInfoService != null) {
                final Optional<String> resolvedName = docRefInfoService.name(docRef);
                if (resolvedName.isEmpty()) {
                    throw new RuntimeException("Unable to find doc with reference '" +
                                               docRef +
                                               "' for term: " +
                                               term.toString());
                }
                return resolvedName.get();
            }
            return docRef.getName();
        } else {
            return docRef.getUuid();
        }
    }
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