neo4j / apoc

Apache License 2.0
96 stars 28 forks source link

Should apoc.export.cypher.all include manual indexes? #153

Closed neo-technology-build-agent closed 1 year ago

neo-technology-build-agent commented 2 years ago

Issue by john-bodley Thursday Aug 03, 2017 at 16:51 GMT Originally opened as https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/535


APOC supports manual indexes for efficient full text search and lookups however when one exports the graph to Cypher according to the documentation, apoc.export.cypher.all(file,config),

exports whole database incl. indexes as Cypher statements to the provided file

however it seems to only include schema indexes. The exporting to separate files documentation provides the only clue that only schema indexes are exported per the schema.cypher extension. This is confirmed by testing,

> cypher-shell 
Connected to Neo4j 3.2.1 at bolt://localhost:7687.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j> CALL apoc.index.list();
+----------------------------------------------------------------------------------------------------------------------------------------------------+
| type   | name   | config                                                                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------------------+
| "NODE" | "id"   | {autoUpdate: "true", `keysForLabel:Entity`: "id", type: "fulltext", to_lower_case: "true", provider: "lucene", labels: "Entity"} |                                                                                   |
| "NODE" | "uuid" | {type: "exact", provider: "lucene"}                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------------------+
2 rows available after 6 ms, consumed after another 0 ms

neo4j> CALL apoc.export.cypher.all('/tmp/graph.cypher', {format: 'plain', separateFiles: true});
+--------------------------------------------------------------------------------------------------------------------------------+
| file                | source                                   | format   | nodes  | relationships | properties | time  | rows |
+--------------------------------------------------------------------------------------------------------------------------------+
| "/tmp/graph.cypher" | "database: nodes(504272), rels(1313576)" | "cypher" | 504272 | 1313576       | 8616039    | 95783 | 0    |
+--------------------------------------------------------------------------------------------------------------------------------+
1 row available after 95813 ms, consumed after another 5 ms
neo4j>

which results in the graph.schema.cypher file containing no reference to the manual index. I realize that these indexes are an APOC extension and not pure Cypher but I was wondering whether they should also be included as part of the export for completeness?

gem-neo4j commented 1 year ago

As this no longer applies to APOC I will close it :) See here for the Cypher supported TEXT indexes!