Neo4j Cypher: Handling Spaces and Wildcards in Lucene Full Screen Search

I created a FullText index named: myFullTextIndex

.

When I want to find a pattern:, the Hello World

request looks like this:

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

      

It works really well.

However, I am unable to find the same string surrounded by wildcards.
I expect that searching for this pattern will return a result:*Hello World*

I tried:

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

      

and

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

      

but doesn't work (syntax errors occured).

Any idea?

+2


source to share


1 answer


When using complex operators and spaces, surround the Lucene inline query with () parentheses.

In your case, using wildcards, the following Cypher works on the tests selected in my database.

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

where is the Lucene part



*Hello World*

      

Note that the () parentheses insert the Lucene sweep safely in Cypher syntax.

See also Neo4j: Lucene match using Cypher (fuzzy)

+2


source







All Articles