module Neoon::Cypher::Schema::Indexes

Public Instance Methods

create_index(key) click to toggle source
# File lib/neoon/cypher/schema/indexes.rb, line 12
def create_index(key)
  cypher_query = "CREATE INDEX ON :#{label}(#{key.to_s.downcase})"
  cypherable(:query => cypher_query)
end
drop_index(key) click to toggle source
# File lib/neoon/cypher/schema/indexes.rb, line 17
def drop_index(key)
  cypher_query = "DROP INDEX ON :#{label}(#{key.to_s.downcase})"
  cypherable(:query => cypher_query)
end
list_indexes() click to toggle source
# File lib/neoon/cypher/schema/indexes.rb, line 6
def list_indexes
  # The only none Cypher query
  idx_keys = Neoon.db.get("/schema/index/#{label}") + Neoon.db.get("/schema/constraint/#{label}")
  idx_keys.reduce({}) { |k, v| k[v.send('property-keys').first.to_sym] = v.type || true; k }
end