问题描述
我需要对另一个表中的列中的大量值进行全文搜索。由于MATCH()需要AGAINST()部分中的值,所以直接:SELECT a.id FROM a,b WHERE MATCH(b.content)AGAINST(a.name)失败并显示AGAINST的参数不正确。
现在,我知道我可以编写一个脚本来查询名称列表,然后搜索它们,但我宁愿制定一个更复杂的查询可以一次处理它。它不需要很快。
想法?
谢谢
不幸的是,说:
看起来您必须搜索如果你使用MySQL的 FULLTEXT
索引作为你的搜索解决方案,那么这些模式是一次一个。
考虑允许搜索许多模式,例如您描述的是倒排索引。虽然这不像真正的全文搜索技术那样灵活或可扩展。
查看我的演示文稿
I need to do a Fulltext search for a whole bunch of values out of a column in another table. Since MATCH() requires a value in the AGAINST() part, a straightforward: "SELECT a.id FROM a,b WHERE MATCH(b.content) AGAINST(a.name)" fails with "Incorrect arguments to AGAINST".
Now, I know I could write a script to query for a list of names and then search for them, but I'd much rather work out a more complex query that can handle it all at once. It doesn't need to be speedy, either.
Ideas?
thanks
Unfortunately, http://dev.mysql.com/doc/refman/5.6/en/fulltext-search.html says:
Looks like you'll have to search for the patterns one at a time if you use MySQL's FULLTEXT
index as your search solution.
The only alternative I can think of to allow searching for many patterns like you describe is an Inverted Index. Though this isn't as flexible or scalable as a true full-text search technology.
See my presentation http://www.slideshare.net/billkarwin/practical-full-text-search-with-my-sql
这篇关于针对列值的MySQL全文搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!