我有以下Cypher查询:
MATCH (n)-[r]->(k)
WHERE ANY(x in keys(n)
WHERE round(apoc.text.levenshteinSimilarity(
TRIM(
REDUCE(mergedString = "", item in n[x]
| mergedString + item + " ")), "syn"), 4)
> 0.8)
RETURN n, r, k
如何返回相似性函数在WHERE子句中生成的分数。
我尝试用WITH来做这件事,没有运气:
MATCH (n)-[r]->(k)
WITH *, [x in keys(n) | [x, round(apoc.text. levenshteinSimilarity(TRIM(REDUCE(mergedString = '', item in n[x] | mergedString + item + ' ')), 'syn'), 4)]] as scores
WHERE [s in scores WHERE s[1] >= 0.8]
RETURN n,r,k,[s in scores WHERE s[1] >= 0.8] AS attr_scores
1条答案
按热度按时间pftdvrlh1#
要想只返回分数大于0.8的相关属性,请将列表理解更新为:
最后,我们与Charchit Kapoor一起找到了最佳解决方案: