The Now Platform® Washington DC release is live. Watch now!
‎03-19-2018 11:21 AM
Hello,
We are facing big issues with (*)+keyword queries on typeahead search. (wildcard at the beginning of a word)
The platform can't handle it, you can wait a very long time before erratic results appear.
This may be corrected in Kingston but this customer is still on Istanbul and is complaining.
I am investigating a way to block end-user query submission and/or just remove the stars from their query
Problem is I don't use regexps everyday, so I am having a really hard time building this regexp :
"OK for anything except a star at the beginning of your search query" : *key-word is invalid, key*word is.
Anyone has a solution please ? or if you have been facing this issue, and have a solution ?
Thank you very much.
Best Regards,
Solved! Go to Solution.
‎03-19-2018 01:25 PM
Hi Karim,
I believe the correct regex would be ^[^\*].+$
The above sequence will allow any collection of characters that doesn't begin with *.
‎03-19-2018 01:25 PM
Hi Karim,
I believe the correct regex would be ^[^\*].+$
The above sequence will allow any collection of characters that doesn't begin with *.
‎03-20-2018 03:50 AM
Thanks Olyn,
I had to do it otherwise :
adding "while (data.q.indexOf("*") == 0) data.q = data.q.substring(1);" in typeahead search, search nav and search page's server scripts.
this could be the workaround for the PRB
With the regexp, we could have a warning for the user in the typeahead field, using ng-pattern = "/^[^\*].+$ /" for the input's ng-model, to add the ng-invalid class to the input, and color the field in red for .ng-invalid.
Thanks a lot, may show useful in the future.
Best Regards,
‎03-20-2018 06:23 AM
Hey Karim,
Glad you were able to figure out a solution that worked for you. That sounds like a solid workaround.
Best,
Olyn
‎03-27-2018 02:34 AM
Thanks !
"%" was an issue too, so :
data.q = $sp.getParameter('q');
//then we get rid of wildcards
while (data.q.indexOf("*") == 0 || data.q.indexOf("%") == 0) data.q = data.q.substring(1);