|
28 | 28 | import org.neo4j.graphdb.Node; |
29 | 29 | import org.neo4j.graphdb.Relationship; |
30 | 30 | import org.neo4j.graphdb.Transaction; |
| 31 | +import org.neo4j.graphdb.index.Index; |
31 | 32 | import org.neo4j.graphdb.index.IndexManager; |
| 33 | +import org.neo4j.graphdb.index.ReadableIndex; |
| 34 | +import org.neo4j.graphdb.index.RelationshipIndex; |
32 | 35 | import org.neo4j.rest.graphdb.index.RestAutoIndexer; |
33 | 36 | import org.neo4j.tooling.GlobalGraphOperations; |
34 | 37 |
|
@@ -79,13 +82,15 @@ private void clearIndex(Map<String, Object> result) { |
79 | 82 | result.put("node-indexes", Arrays.asList(indexManager.nodeIndexNames())); |
80 | 83 | result.put("relationship-indexes", Arrays.asList(indexManager.relationshipIndexNames())); |
81 | 84 | for (String ix : indexManager.nodeIndexNames()) { |
82 | | - if (!(RestAutoIndexer.NODE_AUTO_INDEX).equals(ix)) { // autoindex is not deletable |
83 | | - indexManager.forNodes(ix).delete(); |
| 85 | + Index<Node> nodeIndex = indexManager.forNodes(ix); |
| 86 | + if (!(nodeIndex instanceof ReadableIndex)) { |
| 87 | + nodeIndex.delete(); |
84 | 88 | } |
85 | 89 | } |
86 | 90 | for (String ix : indexManager.relationshipIndexNames()) { |
87 | | - if (!(RestAutoIndexer.RELATIONSHIP_AUTO_INDEX).equals(ix)) { // autoindex is not deletable |
88 | | - indexManager.forRelationships(ix).delete(); |
| 91 | + RelationshipIndex relationshipIndex = indexManager.forRelationships(ix); |
| 92 | + if (!(relationshipIndex instanceof ReadableIndex)) { |
| 93 | + relationshipIndex.delete(); |
89 | 94 | } |
90 | 95 | } |
91 | 96 | } |
|
0 commit comments