Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
387 views
in Technique[技术] by (71.8m points)

indexing - Relationship Labels and Index in Neo4J

It's possible to label the nodes in the new Neo4J 2.0.1, but does that same labelling work on relationships? If I have a relationship of the type :TO, can I create an index on its "statement" property like that?

 CREATE INDEX ON :TO(statement)

Thank you!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

a) you cannot have labels on relationships. A relationship has one type (which can be thought of kind of label). If you need multiple labels, you just create multiple relationships with different types

b) schema indexes on relationships are not possible. A graph query typically starts at nodes and not at relationships since nodes are the "things" in your domain. Starting at a relationship is IMHO often a indication to rethink your graph model. If you're still convinced you need relationship indexing, you can go with legacy indexing.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...