From 4030aa048d1f637e92ce3fe953fa4cb806c5c8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile=20Chemin?= Date: Fri, 30 Aug 2024 13:07:55 +0200 Subject: [PATCH] [BUG] :bug: Fix no users are returned when doing fuzzysearch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cécile Chemin --- .../java/fr/insee/sugoi/store/ldap/LdapReaderStore.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sugoi-api-ldap-store-provider/src/main/java/fr/insee/sugoi/store/ldap/LdapReaderStore.java b/sugoi-api-ldap-store-provider/src/main/java/fr/insee/sugoi/store/ldap/LdapReaderStore.java index e3d07adf..870cb493 100644 --- a/sugoi-api-ldap-store-provider/src/main/java/fr/insee/sugoi/store/ldap/LdapReaderStore.java +++ b/sugoi-api-ldap-store-provider/src/main/java/fr/insee/sugoi/store/ldap/LdapReaderStore.java @@ -149,6 +149,8 @@ public PageResult fuzzySearchUsers( "[ÀÁÂÃÄAÅÇCÈÉÊËEÌÍIÎÏÐÒÓÔOÕÖÙUÚÛÜÝYŸàáâãäåçèéêëìíîïðòóôõöùúûüýÿaeiouc \\-']", "*") .replaceAll("\\*+", "*")); + int originalPageSize = pageable.getSize(); + pageable.setSize(50000); PageResult results = searchOnLdap( config.get(GlobalKeysConfig.USER_SOURCE), @@ -162,7 +164,9 @@ public PageResult fuzzySearchUsers( .filter( u -> removeSpecialChars((String) u.getAttributes().get("common_name")) - .equalsIgnoreCase(normalizedCommonName)) + .toUpperCase() + .contains(normalizedCommonName.toUpperCase())) + .limit(originalPageSize) .collect(Collectors.toList()); results.setResults(filteredUsers); return results;