处理MySQL全文特殊字符 [英] Handling MySQL Full Text Special Characters
问题描述
我正在使用的当前方法是将数据中的所有+字符转换为_plus。它还将&,@,/和#字符转换为文本表示。使用MySQL的全文搜索。你在做什么(用一个预定义的字符串替换特殊字符)是做到这一点的唯一方法。
您可能希望考虑使用 Sphinx搜索。它显然支持转义特殊字符,并且所有报告都比默认的全文搜索快得多。
When using MySQL full text search in boolean mode there are certain characters like + and - that are used as operators. If I do a search for something like "C++" it interprets the + as an operator. What is the best practice for dealing with these special characters?
The current method I am using is to convert all + characters in the data to _plus. It also converts &,@,/ and # characters to a textual representation.
There's no way to do this in nicely using MySQL's full text search. What you're doing (substituting special characters with a pre-defined string) is the only way to do it.
You may wish to consider using Sphinx Search instead. It apparently supports escaping special characters, and by all reports is significantly faster than the default full text search.
这篇关于处理MySQL全文特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!