docs: @SuppressWarnings("unchecked")
      private static void validateTextClause(Object clause,
                                                Boolean[] textClauseLimitReached) throws QueryException {
          Map<String, Object> textClause;
          if (!(clause instanceof Map)) {
              String msg = String.format("Text search expects a Map, found %s instead.", clause);
              throw new QueryException(msg);
          }
  
          textClause = (Map<String, Object>) clause;
          if (textClause.size() != 1) {
              String msg = String.format("Unexpected content %s in text search.", textClause);
              throw new QueryException(msg);
          }
  
          String operator = (String) textClause.keySet().toArray()[0];
          if (!operator.equals(SEARCH)) {
              String msg = String.format("Invalid operator %s in text search", operator);
              throw new QueryException(msg);
          }
  
  
          if (textClauseLimitReached[0]) {
              String msg = "Multiple text search clauses not allowed in a query.  " +
                                       "Rewrite query to contain at most one text search clause.";
              throw new QueryException(msg);
          }
  
          textClauseLimitReached[0] = true;
          validatePredicateValue(textClause.get(operator), operator);
      }