简体   繁体   English

Neo4j和关系属性上的架构索引

[英]Neo4j and schema indexes on relationship properties

As far as I know, Neo4j doesn't support schema indexes on relationship properties right now. 据我所知,Neo4j目前不支持关系属性上的架构索引。 According to the following GitHub issue https://github.com/neo4j/neo4j/issues/7225 there is a big need in such indexes. 根据以下GitHub问题https://github.com/neo4j/neo4j/issues/7225 ,对此类索引的需求很大。

Is there any chance that Neo4j will introduce schema indexes in near future or this is a limitation in Neo4j architecture and can't be implemented at all? Neo4j是否有可能在不久的将来引入架构索引,或者这是Neo4j架构的限制,根本无法实现?

PS PS

I know about Neo4j manual indexes for relationship properties but they also have some limitations versus schema indexes. 我知道用于关系属性的Neo4j手动索引,但是相对于架构索引,它们也有一些限制。

There should be no insurmountable reason why that capability cannot be added in the future. 应该没有不可逾越的理由,为什么将来不能添加该功能。

In the meantime, if you want to use schema indexing, you can consider working around this by "reifying" the relationship type to a node label. 同时,如果要使用架构索引,则可以考虑通过将关系类型“修改”为节点标签来解决此问题。 That is, you can replace each such relationship with a node and 2 relationships. 也就是说,您可以用一个节点和2个关系替换每个这样的关系。

In the following example, you would replace the FOO relationship type with a Foo node label and X and Y relationships. 在以下示例中,您将FOO关系类型替换为Foo节点标签以及XY关系。 With the modified data model, you can create a schema index on Foo . 使用修改后的数据模型,可以在Foo上创建模式索引。

  • Before: (a)-[:FOO]->(b) 之前: (a)-[:FOO]->(b)
  • After: (a)-[:X]->(:Foo)-[:Y]->(b) 之后: (a)-[:X]->(:Foo)-[:Y]->(b)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM