public static ConditionTemplate autocompleteFieldMatching(String text) {
    if (StringUtils.isBlank(text)) {
      return ConditionTemplate.field(Schemas.IDENTIFIER, new IsEqualCriterion("a38"));
    }
    String cleanedText = AccentApostropheCleaner.removeAccents(text).toLowerCase();

    String[] cleanedTextWords = cleanedText.split(" ");

    LogicalSearchValueCondition condition;
    if (cleanedTextWords.length == 1) {
      if (cleanedText.endsWith(" ")) {
        condition = new IsEqualCriterion(cleanedText.trim());
      } else {
        condition = new IsStartingWithTextCriterion(cleanedText.trim());
      }
    } else {
      List<LogicalSearchValueCondition> conditions = new ArrayList<>();
      for (int i = 0; i < cleanedTextWords.length; i++) {
        if (i + 1 == cleanedTextWords.length) {
          if (cleanedText.endsWith(" ")) {
            conditions.add(new IsEqualCriterion(cleanedTextWords[i]));
          } else {
            conditions.add(new IsStartingWithTextCriterion(cleanedTextWords[i]));
          }
        } else {
          conditions.add(new IsEqualCriterion(cleanedTextWords[i]));
        }
      }
      condition = all(conditions);
    }

    return ConditionTemplate.field(Schemas.SCHEMA_AUTOCOMPLETE_FIELD, condition);
  }
 public static ConditionTemplate schemaTypeIsNotIn(List<String> types) {
   List<LogicalSearchValueCondition> schemaTypesCriteria = new ArrayList<>();
   for (String type : types) {
     schemaTypesCriteria.add(LogicalSearchQueryOperators.startingWithText(type));
   }
   return ConditionTemplate.field(Schemas.SCHEMA, not(any(schemaTypesCriteria)));
 }