We use Autoquery to return result base on search fields and we also page our result.
Is there a way to be accent insensitive ?
So André is equal to Andre
Our AutoQuery class look like:
public class QueryUsers : QueryDb<CustomUserAuth>
{
[QueryDbField(Field = "DisplayName",
Term = QueryTerm.Or,
Template = "UPPER({Field}) LIKE UPPER({Value})", ValueFormat = "%{0}%")]
public string DisplayNameContains { get; set; }
…
Thanks!
mythz
May 14, 2018, 3:02pm
2
This is not a feature of AutoQuery. You’d need to either sanitize your inputs so that the search text is normalized or use a DB function that does what you what, I’m not sure what that is though.
For somme language the accent character are confusing when you try to do some search.
So I try to eliminate accent sensitivity on search result. I want to achieve the equivalent of:
I try to replicate that kind of query:
Sql Sample
or like:
select * from users where name like 'HELEN%
’
return
HELEN
HELENA
HÉLÈNA
HELENE
HÉLÈNE
I know how I can do it in SQL but not sure how to integrated well with SS.
mythz
May 14, 2018, 4:25pm
4
Have you tried adding the COLLATE to the end of the query?
[QueryDbField(Field = "DisplayName",
Template = "{Field} LIKE {Value} COLLATE Latin1_General_CI_AI", ValueFormat = "%{0}%")]
public string DisplayNameContains { get; set; }
1 Like
Wow ! Thanks! So elegant
I will see how it react with Chinese or Russian character but for my immediate need it’s perfect
1 Like