【发布时间】:2022-01-15 06:52:42
【问题描述】:
我有一个基于 neo4j:4.4 的自定义 neo4j docker 镜像。 在它启动时,我需要执行一些密码语句,其中包括创建全文索引。我正在使用 apoc.conf 文件:
apoc.import.file.use_neo4j_config=false
apoc.import.file.enabled=true
apoc.export.file.enabled=true
apoc.initializer.neo4j.0=CALL apoc.cypher.runSchemaFile("file:////var/lib/neo4j/db_init/create_regular_indexes.cypher")
apoc.initializer.neo4j.1=CALL apoc.cypher.runSchemaFile("file:////var/lib/neo4j/db_init/create_fulltext_indexes.cypher")
create_fulltext_indexes.cypher文件有以下内容:
CREATE FULLTEXT INDEX CustomerIndex IF NOT EXISTS FOR (n:Customer) ON EACH [n.name];
当我启动 docker 容器时,我在日志中看到执行了 create_fulltext_indexes.cypher,没有显示任何错误,但没有创建 CustomerIndex。 create_regular_indexes.cypher 中的索引是正常创建的。
另外,如果我尝试在容器中运行以下命令:
cypher-shell -u user -p password "CALL apoc.cypher.runSchemaFile(\"file:////var/lib/neo4j/db_init/create_fulltext_indexes.cypher\")"
CustomerIndex 没有创建,但是当我在 neo4j 浏览器中运行 cypher 语句时,它工作正常。
CREATE FULLTEXT INDEX CustomerIndex IF NOT EXISTS FOR (n:Customer) ON EACH [n.name];
对我做错了什么有什么想法吗?
【问题讨论】:
-
我会尝试将它们合并到一个文件中
标签: neo4j full-text-search neo4j-apoc