code: private SearchRequest createRequest(final SearchFilter filter) {
          final SearchRequest request = new SearchRequest();
          request.setBaseDn(this.baseDN);
          request.setSearchFilter(filter);
  
          /** LDAP attributes to fetch from search results. */
          if (getResultAttributeMapping() != null && !getResultAttributeMapping().isEmpty()) {
              final String[] attributes = getResultAttributeMapping().keySet().toArray(new String[getResultAttributeMapping().size()]);
              request.setReturnAttributes(attributes);
          } else if (searchControls.getReturningAttributes() != null && searchControls.getReturningAttributes().length > 0) {
              request.setReturnAttributes(searchControls.getReturningAttributes());
          } else {
              request.setReturnAttributes(ReturnAttributes.ALL_USER.value());
          }
  
          request.setSearchScope(this.searchScope);
          request.setSizeLimit(this.searchControls.getCountLimit());
          request.setTimeLimit(Duration.ofSeconds(searchControls.getTimeLimit()));
          return request;
      }
docs: Creates a search request from a search filter.
  
  @param filter LDAP search filter.
  @return ldaptive search request.