如果我使用默认的Lucene索引引擎,删除索引的Cypher命令是什么?另外,在特定索引中删除索引条目的Cypher命令是什么?
我不知道你的问题是否已过时,因为你可能正在使用更新版本的Neo4j,但在2.2.1版本中,可以通过Cypher
删除索引。
DROP INDEX ON :Label(property)
嗯,我不确定是否有一种使用Cypher
删除Index
的方法。
但是您可以使用Neo4j API
按以下方式执行此操作:
for ( String indexName : server.getDatabase().graph.index()
.nodeIndexNames() )
{
try{
server.getDatabase().graph.index()
.forNodes( indexName )
.delete();
} catch(UnsupportedOperationException e) {
// Encountered a read-only index.
}
}
for ( String indexName : server.getDatabase().graph.index()
.relationshipIndexNames() )
{
try {
server.getDatabase().graph.index()
.forRelationships( indexName )
.delete();
} catch(UnsupportedOperationException e) {
// Encountered a read-only index.
}
}