Skip to content

Commit

Permalink
Fix bug with finding nodes in index with spaces in value.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdvdijk committed Sep 6, 2012
1 parent 620bb11 commit d8e3319
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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]}/#{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
11 changes: 11 additions & 0 deletions spec/integration/rest_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,17 @@
@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 get a relationship index" do
new_node1 = @neo.create_node
new_node2 = @neo.create_node
Expand Down

0 comments on commit d8e3319

Please sign in to comment.