【问题标题】:What are the Cypher commands to delete index and index entry删除索引和索引条目的 Cypher 命令是什么
【发布时间】:2013-07-07 21:58:43
【问题描述】:

如果我使用默认的 Lucene 索引引擎,删除索引的 Cypher 命令是什么?以及在特定索引中删除索引条目的 Cypher 命令是什么?

【问题讨论】:

    标签: neo4j cypher


    【解决方案1】:

    我不知道您的问题是否已过时,因为您知道使用较新版本的 Neo4j,但在 2.2.1 版本中,可以通过 Cypher 删除索引

    DROP INDEX ON :Label(property)
    

    【讨论】:

      【解决方案2】:

      好吧,我不确定是否可以使用 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.
                          }
                  }
      

      你可以看看here,可能对你有帮助..

      【讨论】:

      • 您好 ManSour,感谢您的回答。我发现Cypher删除索引的命令是:index --delete "index_name"。但是仍然不知道使用 Cypher 命令删除特定索引内的索引条目。
      猜你喜欢
      • 1970-01-01
      • 2012-04-28
      • 2023-03-16
      • 2020-06-09
      • 1970-01-01
      • 2020-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多