Sha256: e9381e0985561637937efb1cfcbd434a2d2268e8799d5d4b11681606476baad7

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

module Neoon
  module Cypher
    module Schema
      module Indexes

        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

        def create_index(key)
          cypher_query = "CREATE INDEX ON :#{label}(#{key.to_s.downcase})"
          cypherable(:query => cypher_query)
        end

        def drop_index(key)
          cypher_query = "DROP INDEX ON :#{label}(#{key.to_s.downcase})"
          cypherable(:query => cypher_query)
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
neoon-0.0.5 lib/neoon/cypher/schema/indexes.rb
neoon-0.0.4 lib/neoon/cypher/schema/indexes.rb