I am building my blog by php and MySql, and I want to use a rich-text editor like CKEditor to edit my articles at the back end. So what type of data should I store in MySql, just text, or BLOB? As far as I know, the results of the rich-text editor is in the type of html, so is it okey if I just store them as "string" that is text, which would be better for full-text search? Thanks in advance.

有帮助吗?

解决方案

HTML is just text so store it as VARCHAR or TEXT. It is okay to store as string (types mentioned).

Your full-text search will be improved by indexing. If you store InnoDB database engine, you lose FULLTEXT type indexing that the default MyISAM supports so you need to determine your database engine. Either way, you'll be able to search pretty fast if database indexes fit in memory.

Full text search may be better with a 3rd-party index like Sphinx. Another thing you can do is tokenize every string in the article as separate records and "score" matches to your query (also split) but that is same thing search engines like Sphinx do and much more efficient.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top