I have a graph database in neo4j that I'm constructing and need to be able to search full or partial text on a node referenced by an index. Below is a sample node where I can search using an index called Game:
Node[1]{Type:"Game",Name:"Super Mario Kart",Description:"First Mario Kart Game in the series",Id:"a3b11cd8-b179-4775-a69e-ddcdd7b8369e"}
Here is the Cyper query that I'm using:
START game=node:Game('Name:*Super Mario*') RETURN game;
This query however doesn't return anything. If I modify the query like this, it returns, but I want to be able to search all text in the Name property regardless if there are spaces or not in the text:
START game=node:Game('Name:*Super*') RETURN game;
Here's my C# code for querying the index:
Node<Game> game = client.QueryIndex<Game>("Game", IndexFor.Node, "Name:*" + name + "*").First();
Here's the Game entity class:
public class Game
{
public string Name { get; set; }
public string Description { get; set; }
}
I'm new to Cypher and am mostly looking for the equivalent to SQL's LIKE clause. Once I get the query correctly built and running in Neo4j's console, it should be trivial to get working in Neo4jClient. Please let me know of any suggestions you may have. Thanks.
It turns out that searching on all text was as simple as this:
START game=node:Game('Name: "Mario Kart"') RETURN game;
This doesn't require a '*' character at all and returns all games with the name like 'Mario Kart'. I hope this helps anyone with the same issue.