diff --git a/oxOrm/filter/src/main/java/org/gluu/search/filter/FilterProcessor.java b/oxOrm/filter/src/main/java/org/gluu/search/filter/FilterProcessor.java index 8f9c533f..65226fb9 100644 --- a/oxOrm/filter/src/main/java/org/gluu/search/filter/FilterProcessor.java +++ b/oxOrm/filter/src/main/java/org/gluu/search/filter/FilterProcessor.java @@ -63,4 +63,38 @@ public Filter excludeFilter(Filter genericFilter, Filter... excludeFilters) { return genericFilter; } + public Filter excludeLowerFilter(Filter genericFilter) { + if (genericFilter == null) { + return null; + } + + FilterType type = genericFilter.getType(); + if (FilterType.RAW == type) { + return genericFilter; + } + + Filter[] filters = genericFilter.getFilters(); + if (filters != null) { + List resultFilters = new LinkedList<>(); + for (Filter filter : filters) { + if (filter.getType() == FilterType.LOWERCASE) { + genericFilter.setFilters(null); + genericFilter.setAttributeName(filter.getAttributeName()); + genericFilter.setAssertionValue(filter.getAssertionValue()); + + } + return genericFilter; + } + if (resultFilters.size() == 0) { + return null; + } + + Filter resultFilter = new Filter(type, resultFilters.toArray(new Filter[0])); + resultFilter.setAssertionValue(genericFilter.getAssertionValue()); + + return resultFilter; + } + + return genericFilter; + } } \ No newline at end of file diff --git a/oxOrm/ldap/src/main/java/org/gluu/persist/ldap/impl/LdapEntryManager.java b/oxOrm/ldap/src/main/java/org/gluu/persist/ldap/impl/LdapEntryManager.java index 4ffa222f..2f6aeb3b 100644 --- a/oxOrm/ldap/src/main/java/org/gluu/persist/ldap/impl/LdapEntryManager.java +++ b/oxOrm/ldap/src/main/java/org/gluu/persist/ldap/impl/LdapEntryManager.java @@ -800,7 +800,7 @@ private String[] convertValuesToStringValues(final Object... attributeValues) { } private com.unboundid.ldap.sdk.Filter toLdapFilter(Filter genericFilter) throws SearchException { - return LDAP_FILTER_CONVERTER.convertToLdapFilter(genericFilter); + return LDAP_FILTER_CONVERTER.convertToLdapFilter(filterProcessor.excludeLowerFilter(genericFilter)); } private com.unboundid.ldap.sdk.SearchScope toLdapSearchScope(SearchScope scope) throws SearchScopeException {