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

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, 





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,

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.



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.
Any ideas why this is so terribly slow?

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. 




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. 




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
Loader.
Up arrow icon