Skip to content

Commit

Permalink
Merge pull request #57 from rdvdijk/master
Browse files Browse the repository at this point in the history
Fix bug with finding nodes in index with spaces in value.
  • Loading branch information
maxdemarzi committed Sep 6, 2012
2 parents 620bb11 + 6289b7a commit 8c115ca
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/neography/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def find_node_auto_index(*args)

def find_node_index(*args)
case args.size
when 3 then index = get("/index/node/#{args[0]}/#{args[1]}?query=#{args[2]}") || Array.new
when 3 then index = get("/index/node/#{args[0]}/#{args[1]}?query=\"#{args[2]}\"") || Array.new
when 2 then index = get("/index/node/#{args[0]}?query=#{args[1]}") || Array.new
end
return nil if index.empty?
Expand Down
24 changes: 23 additions & 1 deletion spec/integration/rest_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,28 @@
@neo.remove_node_from_index("test_node_index", key, value, new_node)
end

it "can find a node index with spaces in the value" do
new_node = @neo.create_node
key = generate_text(6)
value = generate_text + ' ' + generate_text
@neo.add_node_to_index("test_node_index", key, value, new_node)
new_index = @neo.find_node_index("test_node_index", key, value)
new_index.should_not be_nil
new_index.first["self"].should == new_node["self"]
@neo.remove_node_from_index("test_node_index", key, value, new_node)
end

it "can find a node index with slashes in the value" do
new_node = @neo.create_node
key = generate_text(6)
value = generate_text + '/' + generate_text
@neo.add_node_to_index("test_node_index", key, value, new_node)
new_index = @neo.find_node_index("test_node_index", key, value)
new_index.should_not be_nil
new_index.first["self"].should == new_node["self"]
@neo.remove_node_from_index("test_node_index", key, value, new_node)
end

it "can get a relationship index" do
new_node1 = @neo.create_node
new_node2 = @neo.create_node
Expand Down Expand Up @@ -387,4 +409,4 @@

end

end
end

0 comments on commit 8c115ca

Please sign in to comment.