Wildcard character in CYPHER

2,240 views
Skip to first unread message

Mohana Krishna

unread,
Aug 12, 2014, 2:45:07 PM8/12/14
to ne...@googlegroups.com
What is the wildcard character in CYPHER?

I wish to query all nodes that have name starting with "Michael".

I have used 'Match n where n.name="Michael:*" return n' which is not giving any results. (It is returning 0 nodes though there are nodes whose name start with Michael)

Please help.

Wes Freeman

unread,
Aug 12, 2014, 3:13:36 PM8/12/14
to Neo4J
The way you need to do this (currently) is with the regex syntax:


Wes

Alan Robertson

unread,
Aug 12, 2014, 4:34:35 PM8/12/14
to ne...@googlegroups.com
Would it speed up (via indexes) if you added 'n.name >= "Michael"'   ?
--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wes Freeman

unread,
Aug 12, 2014, 4:42:41 PM8/12/14
to Neo4J
No. Schema/label indexes are only exact lookups yet.

Wes

Michael Hunger

unread,
Sep 1, 2014, 3:49:00 AM9/1/14
to ne...@googlegroups.com
You can still use FullTextSearch with legacy indexes and neo4j 2.0, see here: http://jexp.de/blog/2014/03/full-text-indexing-fts-in-neo4j-2-0/

Mukesh Khandelwal

unread,
Sep 2, 2014, 12:09:20 AM9/2/14
to ne...@googlegroups.com
Is it better to use a Patricia  (Trie) data structure to store the nodes that need to be 'wildcard searched' ?

How does the Neo4j match compare with storing the data in a Trie data structure in terms of performance, memory, etc?

Michael Hunger

unread,
Sep 2, 2014, 2:26:51 AM9/2/14
to ne...@googlegroups.com
If you have an efficient implementation of that, right now it might be. We'll be adding full FTS functionality to cypher in a later release,
right now you can use the legacy full-text-index as you've seen in my blog post.

In terms of performance -> Neo4j uses Lucene under the hood, you can certainly find comparisons between Lucene's approach and implementations using Tries.

Also, what is your actual use-case if wildcard search is so critical for you?

Michael

Mukesh Khandelwal

unread,
Sep 2, 2014, 5:14:46 AM9/2/14
to ne...@googlegroups.com
The use case is that i am creating nodes for users in my organization, and then provide facility to search for the users. 

Michael Hunger

unread,
Sep 2, 2014, 6:57:57 AM9/2/14
to ne...@googlegroups.com
They you very probably don't have to care about performance and can just use the built-in FTS, see my blog post.

Michael
Reply all
Reply to author
Forward
0 new messages