I have created following Indexes on Label Student in my Embedded graphDb
Schema schema = graphDb.schema();
indexDefinition = schema.indexFor(DynamicLabel.label("Student")).on("NodeType").create();
indexDefinition = schema.indexFor(DynamicLabel.label("Student")).on("Marks").create();
While using cypher MATCH query
This works : match (n:Student) return n;
This also works : match (n:Student) where n.Marks<30 return n;
But, This fails : match (n:Student) where n.Marks=30 return n;
And this too: match (n:Student) where n.Marks='30' return n;
Curious thing is this one works:
start n=node(127) match (n:Student) where n.Marks=30 return n;
Works: I get the expected results, Fails : No result
Can anyone explain this behaviour, as all the properties are already Indexed(Label) and the cypher should return the desired result.
I have also checked if the properties are Indexed or not for the label using :
Label label1 = DynamicLabel.label("Student");
System.out.println(schema.getIndexes(label1));
I am executing the cypher queries using this approach.
[EDIT] Node creation:
Integer marks = 30;
Label label = DynamicLabel.label("Student");
tx = graphDb.beginTx();
Node studentNode = graphDb.createNode(label);
studentNode.setProperty("NodeType", "Student");
studentNode.setProperty("Marks", marks);
tx.success();