【发布时间】:2015-07-05 18:52:24
【问题描述】:
我是 Titan DB 的新手,我想制作自己的 DB。
我想制作两种类型的顶点:用户和特征。两个顶点都将具有索引属性creation_date。
更好的方法是只使用索引或两个z_creation_date 和f_creation_date 创建一个属性类型creation_date?
【问题讨论】:
我是 Titan DB 的新手,我想制作自己的 DB。
我想制作两种类型的顶点:用户和特征。两个顶点都将具有索引属性creation_date。
更好的方法是只使用索引或两个z_creation_date 和f_creation_date 创建一个属性类型creation_date?
【问题讨论】:
您可以对两种顶点类型使用相同的属性,这就是 .indexOnly() 的用途。
mgmt = graph.getManagementSystem()
user = mgmt.makeVertexLabel("user").make()
feature = mgmt.makeVertexLabel("feature").make()
creation_date = mgmt.makePropertyKey("creation_date").dataType(Long.class).make()
mgmt.buildIndex("user_creation_date", Vertex.class).addKey(creation_date).indexOnly(user).buildCompositeIndex()
mgmt.buildIndex("feature_creation_date", Vertex.class).addKey(creation_date).indexOnly(feature).buildCompositeIndex()
【讨论】: