code: private Subquery<CSNode> getMetaDataSubquery(final String metaDataTitle, final String metaDataValue,
              final FilterStringLogic searchLogic) {
          final CriteriaBuilder criteriaBuilder = getCriteriaBuilder();
          final Subquery<CSNode> subQuery = getCriteriaQuery().subquery(CSNode.class);
          final Root<CSNode> root = subQuery.from(CSNode.class);
          subQuery.select(root);
  
          // Create the Condition for the subquery
          final Predicate contentSpecIdMatch = criteriaBuilder.equal(getRootPath(), root.get("contentSpec"));
          final Predicate isMetaData = criteriaBuilder.equal(root.get("CSNodeType").as(Integer.class), CommonConstants.CS_NODE_META_DATA);
          final Predicate metaDataTitleMatch = criteriaBuilder.equal((root.get("CSNodeTitle").as(String.class)), metaDataTitle);
          final Predicate metaDataValueMatch;
          if (searchLogic == FilterStringLogic.MATCHES) {
              metaDataValueMatch = criteriaBuilder.equal(root.get("additionalText").as(String.class), metaDataValue);
          } else {
              final Expression<String> field = criteriaBuilder.lower(root.get("additionalText").as(String.class));
              metaDataValueMatch = criteriaBuilder.like(field, "%" + cleanLikeCondition(metaDataValue.toLowerCase()) + "%");
          }
          subQuery.where(criteriaBuilder.and(contentSpecIdMatch, isMetaData, metaDataTitleMatch, metaDataValueMatch));
  
          return subQuery;
      }
docs: Create a Subquery to check if a Content Spec has a metadata field with the specified value.
  
  @param metaDataTitle The Title of the metadata to be checked.
  @param metaDataValue The Value that the metadata should have.
  @return A subquery that can be used in an exists statement to see if a Content Spec has a metadata field with the specified value.