Skip to content

Commit

Permalink
Updated index methods to Neo4j v1.2.06 API
Browse files Browse the repository at this point in the history
  • Loading branch information
undees authored and maxdemarzi committed Jan 7, 2011
1 parent 5032bcc commit 517bee3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ To Use:
@neo.remove_relationship_properties(rel1, "since") # Remove one property of a relationship
@neo.remove_relationship_properties(rel1, ["since","met"]) # Remove multiple properties of a relationship

@neo.list_indexes # doesn't really seam to do what the api says it does
@neo.add_to_index(key, value, node1) # adds a node to an index with the given key/value pair
@neo.remove_from_index(key, value, node1) # removes a node to an index with the given key/value pair
@neo.get_index(key, value) # gets an index with the given key/value pair
@neo.list_indexes # gives names and query templates for all defined indices
@neo.add_to_index(index, key, value, node1) # adds a node to the specified index with the given key/value pair
@neo.remove_from_index(index, key, value, node1) # removes a node from the specified index with the given key/value pair
@neo.get_index(index, key, value) # queries the specified index with the given key/value pair

@neo.get_path(node1, node2, relationships, depth=4, algorithm="shortestPath") # finds the shortest path between two nodes
@neo.get_paths(node1, node2, relationships, depth=3, algorithm="allPaths") # finds all paths between two nodes
Expand Down
16 changes: 8 additions & 8 deletions lib/neography/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,20 @@ def delete_node!(id)
end

def list_indexes
get("/index")
get("/index/node")
end

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

def remove_from_index(key, value, id)
delete("/index/node/#{key}/#{value}/#{get_id(id)}")
def remove_from_index(index, key, value, id)
delete("/index/node/#{index}/#{key}/#{value}/#{get_id(id)}")
end

def get_index(key, value)
index = get("/index/node/#{key}/#{value}") || Array.new
def get_index(index, key, value)
index = get("/index/node/#{index}/#{key}/#{value}") || Array.new
return nil if index.empty?
index
end
Expand Down Expand Up @@ -373,4 +373,4 @@ def get_depth(depth)
end

end
end
end

0 comments on commit 517bee3

Please sign in to comment.