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

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

问题描述

在Lucene中,短语是一组用双引号引起来的单词例如你好,多莉". 我希望能够做到与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"节点:

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") RETURN 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") RETURN 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天全站免登陆