Neo4j: Lucene phrase matching using Cypher (fuzzy)

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

"hello dolly"~0.1

This finds my "hello dolly"

node:

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

It does not mean:

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

Splitting the whitespace search phrase into individual terms does work:

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

However, my data might contain a string of type "HelloDolly"

that I would like to successfully match against my "hello dolly"

node.

EDIT:

Some other attempts:

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

----> works (finds my "hello" node but is not fuzzy

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

----> doesn't work (finds nothing)

+2


source to share


2 answers


Try the following:



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

      

+1


source


This is an old question, but it might help others:



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

      

+1


source







All Articles