-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In "Phase 2" functionality, how to find/get nodes? #76
Comments
Sorry didn't mean to close it. https://github.com/maxdemarzi/neography/wiki/Phase-2-Nodes <-- additional information. Neography::Node.find(index, key, value) # advanced query of the node index with the given key/value pair
Neography::Node.find(index, query) # advanced query of the node index with the given query |
So now you can do: It returns a single node if only one is found otherwise it returns an array. |
Thanks for looking into it so quickly! For some reason it's unable to find neo_server? See below:
|
Change your gemfile to: gem "neography", :git => "git://github.com/maxdemarzi/neography.git" I think I'm missing some unit tests, but once those are done I'll push a new version. |
Hmm, still getting the same results. Bundle install shows "Using neography (1.0.5) from git://github.com/maxdemarzi/neography.git (at master)". Still gives me:
|
Ok... I just released a 1.0.6 version... still missing tests, but go ahead and give that a shot. |
Looks good, thanks very much. That previous issue with 1.0.5 may in fact have been user error (damned 'bundle exec') as well, but in any case it's working now! |
@maxdemarzi I am trying to figure out how to use Phase 2 as well. Looking at the source I see nodes are created with this:
How does one create nodes with an index? I am trying to figure out how to store my nodes so I can query them based on properties, and if I don't create them with an index, it seems like they become nearly impossible to access. I am building something very similar to your neosocial example. Is Phase 2 capable of doing something like that use case? |
You are right, that's stuff not documented. node1 = Neography::Node.create("age" => 31, "name" => "Max") node1.add_to_index("people", :name) <= would this be better? |
@maxdemarzi Thanks for the quick response! I am a complete neo4j noob, still trying to grok the whole concept, and simultaneously build an app on it. So if the goal is to make it simple for Noob (a good goal I think) and clear, then yes I think the second format is best.
If the key on the index is not the same as the key on the node, or if the value is arbitrary, then you might make the second parameter optional.
Would that even work? Can the value be arbitrary, or does it have to match an actual property value on the node? |
How would I use |
Neography::Node.find(index, query) |
Is it possible to create a node and add it to an index in a single query so it's an atomic operation? |
Look at cypher label functionality for that. We're moving away from complex phase 2 functionality and instead headed down the cypher path. See the cypher gem for possibilities. |
move typecasting closer to read/save to graph
Hi -- this may not be implemented yet, but I wanted to check. When using the "Phase 2" style that mimics neo4j.rb, is there a way to find/get using an index? Without that, I'm trying to determine how to do this:
Obviously this isn't ideal since it's two calls, but also, the Hash returned from the get_node_index() call doesn't actually have the ID in an easy-to-get place -- it seems like I'd have to take "self" and parse out the ID from the end of the URL. Not great.
Is there something in the "Phase 2" functionality that I haven't stumbled on yet? Just curious where this stands. Thanks for the great work on neography!
The text was updated successfully, but these errors were encountered: