简体   繁体   English

如何计算MySQL Blob文本中特定单词出现的次数?

[英]How to count the number of occurrences of a particular word in a MySQL blob text?

I have stored the contents of a text file in a MySQL table as a blob. 我已经将文本文件的内容作为Blob存储在MySQL表中。 I want to count the number of occurrences of a particular word from that text. 我想计算该文本中某个特定单词出现的次数。

Is there any way I can do that? 有什么办法可以做到吗?

Try this 尝试这个

SET @searchthis="lumia"; 
SELECT  CAST((LENGTH(`documents`.`file`) - 
              LENGTH(REPLACE(`documents`.`file`, @searchthis, ""))) /
              LENGTH(@searchthis) AS UNSIGNED
            ) AS searchthis_count
    FROM  documents ;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM