gaupoit
gaupoit

Reputation: 1

Searching in Neo4j

My web application has users and Coworker relationship. I want to search users which has Coworker relationship with specific user. I used this query:

var query = _client
                .Cypher
                .Start(new
                           {
                               //user = Node.ByIndexLookup(IndexHelper.USER_INDEX, "Email", email)

                           }
                ).Match(String.Format("user-[:{0}]-(coworkers)", CoWorker.TypeKey))                
                .Where((User coworkers) => coworkers.Email.Contains(term))
                .Return<Node<User>>("coworkers");

But It throws invalid parameter at

Where((User coworkers) => coworkers.Email.Contains(term)).

How can I replace this condition to search coworker with term? Thanks for reading.

Upvotes: 0

Views: 90

Answers (1)

Tatham Oddie
Tatham Oddie

Reputation: 4290

Cypher doesn't actually support a contains operator like this, hence why the exception says there is no .NET equivalent.

The nearest you could do is use a regex:

WHERE coworkers.Email =~ ".*something.*"

But that would be horribly inefficient because you would run a regex across every node.

Upvotes: 1

Related Questions