Neo4j Cypher:在Lucene全文搜索中处理空白和通配符 [英] Neo4j Cypher: Handling whitespace and wildcards in a Lucene fulltext search

查看:146
本文介绍了Neo4j Cypher:在Lucene全文搜索中处理空白和通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个全文索引,名为:myFullTextIndex.

I created a FullText index named: myFullTextIndex.

当我要搜索模式:Hello World时,查询看起来像:

When I want to search for the pattern: Hello World, the query looks like:

START w=node:myFullTextIndex('title:"Hello World"')

效果很好.

但是,我无法搜索由通配符包围的相同字符串.
我希望对此模式进行搜索以返回结果:*Hello World*

However, I don't manage to search for the same string surrounded by wildcards.
I expect a search on this pattern to return a result: *Hello World*

我尝试过:

START w=node:myFullTextIndex('title:"*Hello World*"')

START w=node:myFullTextIndex('title:*"Hello World"*')

但不起作用(发生语法错误).

but doesn't work (syntax errors occurred).

有什么主意吗?

推荐答案

在使用复杂的运算符和空格时,请用()括号括住嵌入式Lucene查询.

When using complex operators and whitespaces, surround the embedded Lucene query with () brackets.

在使用通配符的情况下,以下Cypher可以在我数据库中经过精心挑选的测试中使用.

In your case with wildcards, the following Cypher works in the handpicked tests in my database.

START w=node:myFullTextIndex('title:(*Hello World*)')

Lucene部分在哪里

where Lucene part is

*Hello World*

请注意,()括号将Cyene语法安全地嵌入了Lucene子部分.

Note that () brackets embed the Lucene subpart safely within the Cypher syntax.

另请参见 Neo4j:使用Cypher(模糊)进行Lucene短语匹配

这篇关于Neo4j Cypher:在Lucene全文搜索中处理空白和通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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