code: @SuppressWarnings("unchecked")
      public <T> Predicate byPattern(Root<T> root, CriteriaBuilder builder, SearchParameters sp, Class<T> type) {
          if (!sp.hasSearchPattern()) {
              return null;
          }
  
          List<Predicate> predicates = newArrayList();
          EntityType<T> entity = em.getMetamodel().entity(type);
          String pattern = sp.getSearchPattern();
  
          for (SingularAttribute<? super T, ?> attr : entity.getSingularAttributes()) {
              if (attr.getPersistentAttributeType() == MANY_TO_ONE || attr.getPersistentAttributeType() == ONE_TO_ONE) {
                  continue;
              }
  
              if (attr.getJavaType() == String.class) {
                  predicates.add(jpaUtil.stringPredicate((Expression<String>) root.get(jpaUtil.attribute(entity, attr)), pattern, sp, builder));
              }
          }
  
          return jpaUtil.orPredicate(builder, predicates);
      }
docs: /*
  Lookup entities having at least one String attribute matching the passed sp's pattern