https://blog.csdn.net/qq_35952946/article/details/79131488sql
https://www.jianshu.com/p/455d3d4922e1markdown
一、用科大訊飛語音識別到的已經中文分詞的文字,例:「我」「想」「銷」「存單」
二、根據上面語音識別出來的多個關鍵字,在數據表中查找出包含上述四個關鍵字中任意若干個數據。spa
表中數據大概這樣:
.net
要今後表中匹配到包含上述四個關鍵字中的任意若干個,可這樣:3d
SELECT * FROM nlu_define_table WHERE JSON_CONTAINS(JSON_ARRAY("我","想","銷","存單"),keywords->'$.keywords') ORDER BY weights DESC;
便可搜索到數據
code
另附上部分sql,以防以後忘記blog
SELECT * FROM nlu_define_table; SELECT * FROM nlu_define_table WHERE keywords LIKE "%銷%"; SELECT * FROM nlu_define_table WHERE JSON_EXTRACT(keywords,'$.keywords') LIKE "%銷%"; SELECT * FROM nlu_define_table WHERE keywords -> '$.keywords' LIKE "%銷%";
其中第三條sql和第四條sql是等效的。。。圖片