Neo4j:使用 Cypher 的 Lucene 短语匹配(模糊) [英] Neo4j: Lucene phrase matching using Cypher (fuzzy)

查看:31
本文介绍了Neo4j:使用 Cypher 的 Lucene 短语匹配(模糊)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Lucene 中,Phrase 是一组被双引号包围的单词例如你好多莉".我希望能够执行此 Lucene 模糊查询的 CYPHER 等效项:

In Lucene, a Phrase is a group of words surrounded by double quotes such as "hello dolly". I would like to be able to do the CYPHER equivalent of this Lucene fuzzy query:

"hello dolly"~0.1

这会找到我的 "hello dolly" 节点:

This finds my "hello dolly" node:

START n=node:node_auto_index("name:"hello dolly"~0.1") RETURN n

这不会:

START n=node:node_auto_index("name:"hella dolly"~0.1") RETURN n

通过空格将搜索短语拆分为单个词条确实有效:

Splitting the search phrase by whitespace into Single Terms does work:

START n=node:node_auto_index("name:hella~0.1 AND name:dolly~0.1") return n

但是,我的数据可能包含像 "HelloDolly" 这样的字符串,我希望它与我的 "hello dolly" 节点成功匹配.

However, my data might contain string like "HelloDolly" which I would like to have matched successfully with my "hello dolly" node.

其他一些尝试:

<代码>START n=node:node_auto_index("name:hello\ dolly") 返回 n ----> 确实有效(找到我的hello dolly"节点,但不模糊

START n=node:node_auto_index("name:hello\ dolly") RETURN n ----> does work (finds my "hello dolly" node, but is not fuzzy

<代码>START n=node:node_auto_index("name:hello\ dolly~0.00001") 返回 n----> 不起作用(什么也没找到)

START n=node:node_auto_index("name:hello\ dolly~0.00001") RETURN n ----> doesn't work (finds nothing)

推荐答案

这是一个老问题,但这可能对其他人有帮助:

It's an old question but this may help others:

START n=node:node_auto_index('name:"hella dolly"~0.1') RETURN n

这篇关于Neo4j:使用 Cypher 的 Lucene 短语匹配(模糊)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆