Last updated
Last updated
Often times combination of alphabetic and word inputs may yield no result if the input phrase is typed in without spaces.
A post content contains these words:
The user types in the following search phrase:
The search will yield therefore NO result - because the search phrase "hello12345" does not match the content string in any way (phrase or it's parts are not a substring of the content).
For us humans this would be an obvious match, but the code can only look for parts of the search input. Words are by default only separated by word separators - commas, spaces, tabs etc..
The custom code above will look for alphanumerics and numbers (and vice versa) in sequence and add spaces between them. Therefore typing in:
..becomes:
This will match the original post content, therefore resolves the issue.
In this knowledge base is a solution to replace some special word boundary characters, in case needed, here is a combination of the two codes.
Changing search input for better fuzzy matching