Skip to content
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

Fix bug with finding nodes in index with spaces in value. #57

Merged
merged 2 commits into from
Sep 6, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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