I want to input $content to get the tag by match at least one keyword in keywords base on the rule document.
for example,
input “some words include key1, and key2.” get:
{"subject":"s1","tag":["tagA"]}
input " "key1* with other words, maybe include key3." get:
{"subject":"s2","tag":["tagA","tagB"]}
input “some info without key.” get:
{"subject":"s3","tag":[]}
sample document:
INSERT INTO default VALUES("doc-1", {"subject":"s1","content":"some words include key1, and key2."});
INSERT INTO default VALUES("doc-2", {"subject":"s2","content":"key1 with other words, maybe include key3."});
INSERT INTO default VALUES("doc-3", {"subject":"s3","content":"some info without key."});
INSERT INTO default VALUES("rule-123", {"type":"rule","rules":[{"tag":"tagA","keywords":["key1","key2"]},{"tag":"tagB","keywords":["key3","key4"]}]});
notice : a) rule should get by document rule-123
; b) content
field is non-English language, so TOKENS()
function can not use here.