docs: @SuppressWarnings("unchecked")
      private static void validateCompoundOperatorClauses(List<Object> clauses,
                                                             Boolean[] textClauseLimitReached) throws QueryException {
  
          for (Object obj : clauses) {
              if (!(obj instanceof Map)) {
                  String msg = String.format("Operator argument must be a Map %s",
                                             clauses.toString());
                  throw new QueryException(msg);
              }
              Map<String, Object> clause = (Map<String, Object>) obj;
              if (clause.size() != 1) {
                  String msg;
                  msg = String.format("Operator argument clause should have one key value pair: %s",
                                      clauses.toString());
                  throw new QueryException(msg);
              }
  
              String key = (String) clause.keySet().toArray()[0];
              if (Arrays.asList(OR, NOT, AND).contains(key)) {
                  // this should have a list as top level type
                  Object compoundClauses = clause.get(key);
                  validateCompoundOperatorOperand(compoundClauses);
                  // validate list
                  validateCompoundOperatorClauses((List<Object>) compoundClauses,
                                                              textClauseLimitReached);
              } else if (!(key.startsWith("$"))) {
                  // this should have a map
                  // send this for validation
                  validateClause((Map<String, Object>) clause.get(key));
              } else if (key.equalsIgnoreCase(TEXT)) {
                  // this should have a map
                  // send this for validation
                  validateTextClause(clause.get(key), textClauseLimitReached);
              } else {
                  String msg = String.format("%s operator cannot be a top level operator", key);
                  throw new QueryException(msg);
              }
  
          }
      }