code: public static SearchFilter newSearchFilter(final String filterQuery, final String... params) {
          final SearchFilter filter = new SearchFilter();
          filter.setFilter(filterQuery);
          if (params != null) {
              for (int i = 0; i < params.length; i++) {
                  if (filter.getFilter().contains("{" + i + "}")) {
                      filter.setParameter(i, params[i]);
                  } else {
                      filter.setParameter("user", params[i]);
                  }
              }
          }
          LOGGER.debug("Constructed LDAP search filter [{}]", filter.format());
          return filter;
      }
docs: Constructs a new search filter using {@link SearchExecutor#searchFilter} as a template and
  the username as a parameter.
  
  @param filterQuery the query filter
  @param params      the username
  @return Search filter with parameters applied.