This is a migrated thread and some comments may be shown as answers.

Search with Accent Insensitive

5 Answers 182 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Luc
Top achievements
Rank 1
Luc asked on 09 Mar 2011, 07:31 PM
I'm looking for a way to have "accent insensitive" search

ex: é  =>  e will be the same

Any clues ?

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 10 Mar 2011, 08:26 AM
Hi,

 Unfortunately we are not aware of such approach. 

Best wishes,
Vlad
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Luc
Top achievements
Rank 1
answered on 10 Mar 2011, 02:19 PM
Do you have some sample with creating expression ? 
You have a sample for search within all columns... all it neeeded is to create some kind of expression.. 
0
Luc
Top achievements
Rank 1
answered on 10 Mar 2011, 02:20 PM
Do you have some sample with creating expression ? 
You have a sample for search within all columns... all it neeeded is to create some kind of expression.. 
0
Accepted
Yavor Georgiev
Telerik team
answered on 10 Mar 2011, 05:15 PM
Hello Luc,

 Internally, our FilterDescriptor generates a call to String.Compare(string, string), when it needs to check the equality of two strings. In order to ignore accents when performing string comparison, you need to use a different overload. Here's an example:
string.Compare("résumé", "resume", CultureInfo.InvariantCulture, CompareOptions.IgnoreNonSpace)

will return 0, indicating that the strings are equal.

 In order to plug that into our data engine, you can use our generic FilterDescriptor class like so:
var descriptor = new FilterDescriptor<BusinessObject>();
descriptor.FilteringExpression = dataObject =>
    string.Compare(dataObject.MyAccentedStringProperty,
        "nonAccentedValue",
        CultureInfo.InvariantCulture,
        CompareOptions.IgnoreNonSpace) == 0;

 You can even create your own kind of FilterDescriptor by implementing the IFilterDescriptor interface and constructing the filtering expression manually, similar to this article in our documentation.

All the best,
Yavor Georgiev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Luc
Top achievements
Rank 1
answered on 10 Mar 2011, 05:49 PM
Thank!!!!!!!
Tags
GridView
Asked by
Luc
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Luc
Top achievements
Rank 1
Yavor Georgiev
Telerik team
Share this question
or