Neo4j:通过属性不平等加快关系匹配 [英] Neo4j: Speed up Relationship matching by property inequality

查看:72
本文介绍了Neo4j:通过属性不平等加快关系匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Neo4j 3.0.5。

I'm using Neo4j 3.0.5.

我的查询如下:

MATCH (cd:ConnectionDay)-[c:Connection]->()
WHERE id(cd)= { id } AND c.departure <= { departure }
RETURN c

在我的图中,连接数关系非常高,我正在寻找一种加快检索速度的方法。

In my graph, the number of Connection relations is very high and I'm looking for a way to speed up the retrieval. Is there a way to create an index for the departure property?

无论如何我都在使用嵌入式Java API,因此不使用Cypher的解决方案也可以

I'm using the Embedded Java API anyway, so solutions that aren't using Cypher are ok, too.

推荐答案

此外:不建议您使用本机neo4j ID查找节点,因为删除其本机ID即可重复使用。添加您自己的属性来存储您知道永久唯一的ID会更安全。

Neo4j当前不支持索引关系属性。如果要使用索引,则可以更改数据模型以确认 连接关系作为节点。例如,您的新数据模型将如下所示:

Neo4j does not currently support indexing for relationship properties. If you want to use indexing, you can alter you data model to "reify" your Connection relationships as nodes. For example, your new data model would look something like this:

(cd:ConnectionDay)-[:CONNECTS_TO]->(c:Connection {departure: 123})-[]->()

这篇关于Neo4j:通过属性不平等加快关系匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆