Skip to content

Commit

Permalink
Merge branch 'master' of github.com:maxdemarzi/neography
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdemarzi committed May 2, 2014
2 parents af15980 + 2530d54 commit 101e141
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/neography/rest/node_auto_indexes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def find_node_auto_index_by_value(key, value)
end

def query_node_auto_index(query_expression)
@connection.get("/index/auto/node/?query=%{query}" % {:query => query_expression}) || []
@connection.get("/index/auto/node/?query=%{query}" % {:query => encode(query_expression)}) || []
end

def get_node_auto_index_status
Expand Down
5 changes: 4 additions & 1 deletion spec/integration/rest_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,10 @@
it "can query a node from an automatic index" do
new_node = @neo.create_node("name" => "Max")
existing_nodes = @neo.find_node_auto_index("name:Max")
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).should be_true
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).should be_true
# check that more complex queries are correctly handled
existing_nodes = @neo.find_node_auto_index("name:Max OR name:Max")
existing_nodes.collect{|n| n["self"]}.include?(new_node["self"]).should be_true
end

it "can get a relationship from an automatic index" do
Expand Down
4 changes: 4 additions & 0 deletions spec/unit/rest/node_auto_indexes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class Rest
it "finds by query if no value passed to #find_or_query" do
subject.connection.should_receive(:get).with("/index/auto/node/?query=some_query")
subject.find_node_auto_index("some_query")

query = "some_query AND another_one"
subject.connection.should_receive(:get).with("/index/auto/node/?query=#{URI.encode(query)}")
subject.find_node_auto_index(query)
end

it "finds by key and value" do
Expand Down

0 comments on commit 101e141

Please sign in to comment.