Full-text search in Neo4j with spaces
When neo4j lucene's auto index is in exact mode (which is the standard) queries like:
start n=node:node_auto_index('name:asfd\\ a*') return n
Work right (assuming you have a named node asdf adsf
).
However, if you switch the index to full text mode after these instructions (including deleting the index and reassigning the indexed property), the same query does not return any results.
Original question
Trying to search neo4j using full text index while setting wildcard after space doesn't work.
See the graphical list: http://gist.neo4j.org/?74c5a0bb4587cf4b5489
source to share
Insert Lucene part of Cypher with another pair of () brackets.
Lucene's query syntax documentation states that:
Lucene supports single and multi-character group searches within the same term (not in phrase queries).
Therefore, you cannot use a wildcard *
with a phrase (it won't work :) "asfd a*"
. Instead, find two separate members with an operator AND
:
start n=node:node_auto_index('name:(asfd AND a*)') return n
source to share
You can write your request like:
MATCH (n)
WHERE n.name =~ 'asfd.*'
RETURN n
More information here: http://docs.neo4j.org/chunked/milestone/query-where.html
source to share