neo4j - 从 Neo4j 获取每个组的最高搜索结果
问题描述
我正在使用 Neo4j 的全文搜索功能来获取最接近搜索字符串输入列表的匹配技能。在密码查询下面。
UNWIND ["nursing care requirements", "relatives tutoring student nurses", "blood pressures", "emotional support", "intravenous infusions", "junior staff", "patient samples", "pulses", "workloads"] AS x
CALL db.index.fulltext.queryNodes("full-text-skills", x) YIELD node, score
RETURN x, node.name, score
它运行良好并返回所有匹配结果(上例为 1000 行)。score
现在我想根据返回的属性获取最匹配的技能db.index.fulltext.queryNodes
(列表中每个输入项 1 行)。我尝试在return
语句之后添加限制,但它限制了整个输出。我真正想要的是在输入列表中限制每个项目的搜索结果。
解决方案
我终于找到了解决上述问题的方法。我们可以使用 collect 来收集每组的结果,并根据限制我们可以得到每组的结果。密码查询将是 -
UNWIND ["nursing care requirements", "relatives tutoring student nurses", "blood pressures", "emotional support", "intravenous infusions", "junior staff", "patient samples", "pulses", "workloads"] AS x
CALL db.index.fulltext.queryNodes("full-text-skills", x) YIELD node, score
RETURN x,collect(node.name)[0..3]
推荐阅读
- amazon-web-services - 从在另一个 AWS 账户中运行的 lambda 更新 SSM 参数?
- python - 如何将字典转换为数据框并爆炸
- c# - 保存搜索字符串以在 ASP.NET Core Web 应用程序的其他 cshtml 页面中使用
- stripe-payments - 如何识别试用结束后开始付款订阅的 Stripe 客户
- c# - .Net Core SignOut() RedirectUri 不起作用
- javascript - 在 React Native 和 Nodejs 中点击支付网关
- javascript - precacheAndRoute 在 addToCacheList 上出错
- python-3.x - 如何使用正则表达式获取此字符串的 asin?
- javascript - 我可以在 React Provider 中进行 api 调用吗?
- c# - UWP 拦截 Webview POST 请求并获取内容