Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Cypher seems to not like nil values on properties? #222

cfitz opened this Issue · 2 comments

2 participants



Seem to have run into something odd while working on the updated devise-neo4j....

class DumbUser < Neo4j::Rails::Model
property :a_token

jruby-1.7.0 :136 > DumbUser.to_adapter.find_first( { "a_token" => "kkk" } )
=> nil

jruby-1.7.0 :139 > d = DumbUser.create!
=> #, @messages={}>, @_properties={"_classname"=>"DumbUser"}, @_relationships={}, @changed_attributes={}, @_java_node=#Java::OrgNeo4jKernelImplCore::NodeProxy:0x55b2fcac, @_create_or_updating=nil, @_properties_before_type_cast={}, @previously_changed={"_classname"=>["DumbUser", "DumbUser"]}, @validation_context=nil>

jruby-1.7.0 :140 > d.a_token
=> nil

jruby-1.7.0 :141 > DumbUser.to_adapter.find_first( { "a_token" => "kkk" } )
Java::OrgNeo4jCypher::EntityNotFoundException: The property 'a_token' does not exist on Node[10971]
from org.neo4j.cypher.internal.commands.Property.compute(Expression.scala:221)
from org.neo4j.cypher.internal.commands.Expression$$anonfun$apply$1.apply(Expression.scala:30)
from scala.collection.MapLike$class.getOrElse(MapLike.scala:122)
from scala.collection.JavaConversions$JMapWrapper.getOrElse(JavaConversions.scala:792)
from org.neo4j.cypher.internal.commands.Expression.apply(Expression.scala:30)
from org.neo4j.cypher.internal.commands.Equals.isMatch(ComparablePredicate.scala:51)
from org.neo4j.cypher.internal.pipes.matching.SimplePatternMatcherBuilder$$anonfun$getMatches$1$$anonfun$apply$3.apply(SimplePatternMatcherBuilder.scala:93)
from org.neo4j.cypher.internal.pipes.matching.SimplePatternMatcherBuilder$$anonfun$getMatches$1$$anonfun$apply$3.apply(SimplePatternMatcherBuilder.scala:93)
from scala.collection.LinearSeqOptimized$class.forall(LinearSeqOptimized.scala:69)

Looks like if one of the objects has a nil value, it causes the cypher query to stop. Maybe it's a type conversion between ruby nil and java null ?


If there is no index declared on the property it will use Cypher. According to the stacktrace it tries to perform a cypher query. I should really change that the property must not be required on each node for the cypher query (a new Issue ?)

Try to change the line:

so that it instead make the key optionally.

    cypher["#{k}?"] == v 

ah I think that putting a index on the properties is the way to do...issue now is that devise is expecting a nil value..... looks like if the value is nil after a new model is initialized, but if it's change then deleted, it return a "" string. i've fixed this by making a NilClass type converter, so that empty strings are converted to nil. Would this be something to add to the neo4j orm?

-ps i think this ticket is irrelevant now...close it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.