-
I want to filter users by name or email but ignoring the case. I couldn't find such functionality in the documentation. Is it even possible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is definitely possible and there are multiple mechanisms. In Elide 4, RSQL is case insensitive by default. In Elide 5, RSQL is case sensitive by default but has case insensitive operators for private static final ComparisonOperator INI = new ComparisonOperator("=ini=", true);
private static final ComparisonOperator NOT_INI = new ComparisonOperator("=outi=", true); You can use these operators in queries like: If you want to change the case sensitivity globally, you can configure the RSQL filter dialect with a CaseSensitivityStrategy. In Spring, you can override the @Bean
public Elide initializeElide(EntityDictionary dictionary,
DataStore dataStore, ElideConfigProperties settings) {
ElideSettingsBuilder builder = new ElideSettingsBuilder(dataStore)
...
//FIQLCompliant is a strategy that is always case insensitive.
.withJoinFilterDialect(new RSQLFilterDialect(dictionary, new FIQLCompliant()))
.withSubqueryFilterDialect(new RSQLFilterDialect(dictionary, new FIQLCompliant()))
...
} If you want to change the mechanism for a particular operator on a particular model field, you can provide a JPQLPredicateGenerator to generate the JPQL fragment for that operator on the given field: FilterTranslator.registerJPQLGenerator(Operator.INFIX_CASE_INSENSITIVE, getClassType(Author.class), "name", generator); This code can be inserted during your application configuration. More information can be found here. I'll file a ticket to add more information in the documentation about all of these options. |
Beta Was this translation helpful? Give feedback.
This is definitely possible and there are multiple mechanisms.
In Elide 4, RSQL is case insensitive by default. In Elide 5, RSQL is case sensitive by default but has case insensitive operators for
in
andnot in
. These can also be used with wildcards to get infix, prefix, and postfix behavior.You can use these operators in queries like:
/post?filter=title=ini=*today*
If you want to change the case sensitivity globally, you can configure the RSQL filter dialect with a CaseSensitivityStrategy. In Spring, you ca…