MySQL - search in longtext
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.
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?
Thanks for your time.
You are correct, FULLTEXT doesn't work with LONGTEXT column types, according to the documentation.
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.
I think you should consider using a concatenation of data stored in a FullText, and an ID stored in another field.
If you require the data to be seperated into fields you can use another table with seperated fields joined with the first table by ID. This way you can use both LongText (in the table with seperate fields), and fulltext in the search table.
精彩评论