MySQL - 在长文本中搜索 [英] MySQL - search in longtext
本文介绍了MySQL - 在长文本中搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我相信这个问题对很多像我这样的 MySQL 新手会有用.有没有办法搜索 LONGTEXT 类型?如我所见,FULLTEXT 只能用于 TEXT 字段,由于大小原因,这不适合我.
I believe this question will be useful for many MySQL newbies like me. Are there any means to search through the LONGTEXT type? As I see, FULLTEXT can be used only for TEXT fields, which doesn't suit me, because of size.
附言我听说 LONGTEXT 存储为 BLOB,因此无法使用标准方法进行搜索.但是有什么解决方法吗?
P.S. I heard around, that LONGTEXT is stored as a BLOB, and therefore can't be searched with standard methods. But are there any workarounds?
感谢您的时间.
推荐答案
您是对的,根据 文档.
您可以通过 LIKE 功能实现自己的搜索:
You can implement your own searching through the LIKE functionality:
select postid,content from POSTS where content like '%keyword%';
但这远不如使用全文搜索有效.
but this will be nowhere as efficient as using FULLTEXT searching.
这篇关于MySQL - 在长文本中搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文