code: public static Response<SearchResult> executeSearchOperation(final ConnectionFactory connectionFactory,
                                                                  final String baseDn,
                                                                  final SearchFilter filter,
                                                                  final String[] binaryAttributes,
                                                                  final String[] returnAttributes) throws LdapException {
          try (val connection = createConnection(connectionFactory)) {
              val searchOperation = new SearchOperation(connection);
              val request = LdapUtils.newLdaptiveSearchRequest(baseDn, filter, binaryAttributes, returnAttributes);
              request.setReferralHandler(new SearchReferralHandler());
              return searchOperation.execute(request);
          }
      }
docs: Execute search operation.
  
  @param connectionFactory the connection factory
  @param baseDn            the base dn
  @param filter            the filter
  @param binaryAttributes  the binary attributes
  @param returnAttributes  the return attributes
  @return the response
  @throws LdapException the ldap exception