SfAutoComplete - Advanced search with multiple keywords
Hi there,
how can we perform a search for two or more snippets that are seperated by spaces?
e.g. "jo va" meaning "jo" AND "va":
OK John Savage
NO John Miller
NO Tom Savage
Cheers,
Volker
how can we perform a search for two or more snippets that are seperated by spaces?
e.g. "jo va" meaning "jo" AND "va":
OK John Savage
NO John Miller
NO Tom Savage
Cheers,
Volker
SIGN IN To post a reply.
4 Replies
1 reply marked as answer
SN
Sevvandhi Nagulan
Syncfusion Team
February 24, 2021 09:15 AM UTC
Hi Volker,
Greetings from Syncfusion support.
We checked the reported requirement. We achieved the requested requirement by using the ‘Predicate’ of dataManager in the filtering event. We split the string based on the space and passed each value to the predicate method. Refer to the code below
|
public async Task OnFiltering(FilteringEventArgs args)
{
args.PreventDefaultAction = true;
string[] subs;
var pre = new WhereFilter();
var predicate = new List<WhereFilter>();
if(args.Text.Contains(" "))
{
subs = args.Text.Split(' ');
foreach (string value in subs)
{
predicate.Add(new WhereFilter() { Condition = "and", Field = "Text", value = value, Operator = "contains", IgnoreAccent = true, IgnoreCase = true });
}
pre = WhereFilter.And(predicate);
query = new Query().Where(pre);
}
else
{
query = new Query().Where("Text", "contains", args.Text,true,true);
}
await this.autoObj.Filter(LocalData, query);
} |
Please find the sample below,
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/AutoComplete_Filtering-1144123961
Please check the above sample and get back to us if you need further assistance.
Regards,
Sevvandhi N
VO
Volker
February 24, 2021 03:04 PM UTC
Hi Sevvandhi,
This is my implementation based on your solution:

Attachment: 20210224_15h46_11_8227ca49.zip
thank you for your quick reply.
I made some test using two SfAutoComplete components side by side.
One is the default way (right side), the other one uses your filter event (left side).
Both components are bound to a testDB on a SQL-Server consuming 100.000 test-accounts to simulate a real-world application.

One is the default way (right side), the other one uses your filter event (left side).
Both components are bound to a testDB on a SQL-Server consuming 100.000 test-accounts to simulate a real-world application.
This is my implementation based on your solution:
What I found out is that using filtering event dramatically reduces the result speed when searching, even if we type in the exact same phrase.
In addition when typing in the 3rd character (eg. "l" of "vol", or "." of "28.") the cursors jumps back and forth, the 3rd character disappears and comes back later, as can be seen in the video, too.
Please have a look at the video.
In addition when typing in the 3rd character (eg. "l" of "vol", or "." of "28.") the cursors jumps back and forth, the 3rd character disappears and comes back later, as can be seen in the video, too.
Please have a look at the video.
Any ideas why this is so terribly slow?
Cheers,
Volker
Cheers,
Volker
Attachment: 20210224_15h46_11_8227ca49.zip
SN
Sevvandhi Nagulan
Syncfusion Team
March 2, 2021 11:35 AM UTC
Hi Volker,
Query 1: What I found out is that using filtering event dramatically reduces the result speed when searching, even if we type in the exact same phrase.
We checked the reported issue by preparing q sample with large data source such as 100 data. However, the performance problem did not occur at our end. Please take a look at the example below.
Please find the sample below.
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/AutoComplete_Predicate_Filtering1096684572
Query 2: In addition when typing in the 3rd character (eg. "l" of "vol", or "." of "28.") the cursors jumps back and forth, the 3rd character disappears and comes back later, as can be seen in the video, too.
We have confirmed the reported issue as a bug at our end and this fix will be included in our Volume 1 Main release which is expected to be rolled out on end of March 2021. We appreciate your patience until then.
You can now track the reported issue from the below feedback link.
Feedback link: https://www.syncfusion.com/feedback/22652/
Regards,
Sevvandhi N
BC
Berly Christopher
Syncfusion Team
April 1, 2021 06:03 AM UTC
Hi Volker,
We are glad to announce that our Essential Studio 2021 Volume 1 release v19.1.0.54 is rolled out and is available for download under the following link.
The fix for the issue “Characters getting missed when typing fast in a ComboBox and other controls” is included in the above release.
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Berly B.C
Marked as answer
SIGN IN To post a reply.