MySQL full text search equivalents to Google search: Difference between revisions

Jump to navigation Jump to search
+ English issue
mNo edit summary
(+ English issue)
Line 1: Line 1:
MySQL full text Search equivalents to Google search when the keyword written in  Chinese.


== AND ==
== AND ==
Line 27: Line 26:
* Google: {{kbd | key = <nowiki>狐狸*叫</nowiki>}}
* Google: {{kbd | key = <nowiki>狐狸*叫</nowiki>}}
* MySQL: {{kbd | key = <nowiki>column_name LIKE '狐狸%叫'</nowiki>}}<ref>[http://www.mysqltutorial.org/mysql-like/ Using MySQL LIKE Operator to Select Data Based on Pattern Matching]</ref>
* MySQL: {{kbd | key = <nowiki>column_name LIKE '狐狸%叫'</nowiki>}}<ref>[http://www.mysqltutorial.org/mysql-like/ Using MySQL LIKE Operator to Select Data Based on Pattern Matching]</ref>
== English issue ==
When the keyword is short and written in English e.g. {{kbd | key = <nowiki>AI</nowiki>}}, the query result using {{kbd | key = <nowiki>column_name LIKE '%AI%'</nowiki>}} is NOT what you want.
* (1) Remove all non-alpha-numeric-characters<ref>[https://stackoverflow.com/questions/6942973/how-to-remove-all-non-alpha-numeric-characters-from-a-string mysql - How to remove all non-alpha numeric characters from a string? - Stack Overflow]</ref> (2) REGEXP word boundaries<ref>[https://stackoverflow.com/questions/18901704/mysql-regexp-word-boundaries-and-double-quotes regex - MySQL REGEXP word boundaries [[:<:]] [[:>:]] and double quotes - Stack Overflow]</ref> e.g. {{kbd | key = <nowiki>(REPLACE(CONVERT(column_name USING ascii), '?', ' ') REGEXP '([[:<:]])AI([[:>:]])')</nowiki>}}


== Ignore special characters ==
== Ignore special characters ==

Navigation menu