Does anyone know a good algorithm to search a string on whole words only. For example, look for order and not order_line in a query.
This could be an useful addition to code search.
Does anyone know a good algorithm to search a string on whole words only. For example, look for order and not order_line in a query.
This could be an useful addition to code search.
Maybe you can find some inspiration using for example scholar.google.com, I am pretty sure this is a well researched topic. A quick search led me to this overview, it states some different search techniques. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC61442/
Something like this should work:
where '.' + column_to_search + '.'
like '%%^a-z_]search_termm^a-z_]%'
This query adds a period before the column to take into account situations where the word is at the beginning or end, and then checks if the word is enclosed by characters other than a to z or underscore.
Perhaps an option if you want to search on words is the use of FullText search:
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.