Module: Neoon::Client::Indexing

Included in:
Connection
Defined in:
lib/neoon/client/indexing.rb

Instance Method Summary collapse

Instance Method Details

#create(label, keys = []) ⇒ Object



10
11
12
13
14
# File 'lib/neoon/client/indexing.rb', line 10

def create(label, keys = [])
  keys.each do |key|
    Neoon.db.cypher("CREATE INDEX ON :#{label}(#{key.to_s.downcase})")
  end
end

#drop(label, keys = []) ⇒ Object



16
17
18
19
20
21
# File 'lib/neoon/client/indexing.rb', line 16

def drop(label, keys = [])
  keys.each do |key|
    Neoon.db.cypher("DROP INDEX ON :#{label}(#{key.to_s.downcase})")
  end
  neo_index_list
end

#list(label) ⇒ Object



5
6
7
8
# File 'lib/neoon/client/indexing.rb', line 5

def list(label)
  Neoon.db.get("/schema/index/#{label}")
    .map{|f| f.send("property-keys")}.flatten.map(&:to_s).sort
end