Skip to content

Commit

Permalink
Merge pull request #13 from HeshamAmiri/master
Browse files Browse the repository at this point in the history
fixes for adding nodes and relationships to indexes
  • Loading branch information
maxdemarzi committed Oct 17, 2011
2 parents 0aee952 + 0ae5090 commit f698aea
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GEM
httparty (0.7.4)
crack (= 0.1.8)
json (1.4.6)
json (1.4.6-java)
net-http-spy (0.2.1)
rake (0.8.7)
rspec (2.0.1)
Expand All @@ -34,6 +35,6 @@ PLATFORMS
DEPENDENCIES
fakeweb (~> 1.3.0)
neography!
net-http-spy (~> 0.2.1)
net-http-spy (= 0.2.1)
rake (~> 0.8.7)
rspec (~> 2.0.0.beta.22)
9 changes: 5 additions & 4 deletions lib/neography/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,9 @@ def create_node_index(name, type = "exact", provider = "lucene")
end

def add_node_to_index(index, key, value, id)
options = { :body => (self.configuration + "/node/#{get_id(id)}").to_json, :headers => {'Content-Type' => 'application/json'} }
post("/index/node/#{index}/#{key}/#{value}", options)
options = { :body => ({:uri => self.configuration + "/node/#{get_id(id)}", :key => key, :value => value }).to_json, :headers => {'Content-Type' => 'application/json'} }
#post("/index/node/#{index}/#{key}/#{value}", options)
post("/index/node/#{index}", options)
end

def remove_node_from_index(*args)
Expand Down Expand Up @@ -283,8 +284,8 @@ def create_relationship_index(name, type = "exact", provider = "lucene")
end

def add_relationship_to_index(index, key, value, id)
options = { :body => (self.configuration + "/relationship/#{get_id(id)}").to_json, :headers => {'Content-Type' => 'application/json'} }
post("/index/relationship/#{index}/#{key}/#{value}", options)
options = { :body => ({:uri => self.configuration + "/relationship/#{get_id(id)}", :key => key, :value => value}).to_json, :headers => {'Content-Type' => 'application/json'} }
post("/index/relationship/#{index}", options)
end

def remove_relationship_from_index(*args)
Expand Down
2 changes: 1 addition & 1 deletion lib/neography/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Neography
VERSION = "0.0.13"
VERSION = "0.0.14"
end
2 changes: 1 addition & 1 deletion neography.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]

s.add_development_dependency "rspec", "~> 2.0.0.beta.22"
s.add_development_dependency "net-http-spy", "~> 0.2.1"
s.add_development_dependency "net-http-spy", "0.2.1"
s.add_development_dependency "fakeweb", "~> 1.3.0"
s.add_development_dependency "rake", "~> 0.8.7"
s.add_dependency "httparty", "~> 0.7.3"
Expand Down
6 changes: 3 additions & 3 deletions spec/integration/rest_traverse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
paths.should_not be_nil

paths[0]["nodes"].should == [@new_node1["self"], @new_node2["self"]]
paths[1]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"]]
paths[2]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node5["self"]]
paths[1]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node5["self"]]
paths[2]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"]]
paths[3]["nodes"].should == [@new_node1["self"], @new_node2["self"], @new_node3["self"], @new_node4["self"]]
end

Expand Down Expand Up @@ -131,7 +131,7 @@
@neo.create_relationship("friends", @new_node3, @new_node4)
@neo.create_relationship("friends", @new_node4, @new_node5)
@neo.create_relationship("friends", @new_node3, @new_node5)
nodes = @neo.traverse(@new_node1, "nodes", {"relationships" => {"type"=> "friends", "direction" => "out"},
nodes = @neo.traverse(@new_node1, "node", {"relationships" => {"type"=> "friends", "direction" => "out"},
"return filter" => {"language" => "builtin", "name" => "all"},
"depth" => 4} )
nodes.should_not be_nil
Expand Down

0 comments on commit f698aea

Please sign in to comment.