|| apoc.schema.node.indexExists - APOC 核心文档 - Neo4j 文档

apoc.schema.node.indexExists

详情

语法

apoc.schema.node.indexExists(labelName, propertyName)

描述

根据给定 NODE 标签是否存在带有给定属性名称的索引,返回一个 BOOLEAN 值。

参数

名称

类型

描述

labelName

STRING

要检查索引的节点标签。

propertyName

LIST<STRING>

要检查索引的属性名称。

返回

BOOLEAN

此函数不被认为是安全的,不建议从多个线程运行。因此,并行运行时不支持此函数。欲了解更多信息,请参阅 Cypher 手册 → 并行运行时

使用示例

本节中的示例基于已应用以下约束的数据库

CREATE CONSTRAINT personName FOR (person:Person)
REQUIRE person.name IS UNIQUE;

CREATE CONSTRAINT userId FOR (user:User)
REQUIRE user.id IS UNIQUE;

CREATE INDEX personCity FOR (person:Person)
ON (person.city);
RETURN apoc.schema.node.indexExists("Person", ["name"]) AS output;
结果
输出

TRUE

RETURN apoc.schema.node.indexExists("Person", ["city"]) AS output;
结果
输出

TRUE

© . This site is unofficial and not affiliated with Neo4j, Inc.