首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Neo4jClient增加索引的关系

用Neo4jClient增加索引的关系
EN

Stack Overflow用户
提问于 2013-08-15 07:53:09
回答 1查看 73关注 0票数 0

将关系添加到Neo4jClient中已经创建的关系索引的语法是什么?

我找到了下面的post (Adding a relationship to an index in neo4jclient),但它只说明语法类似于节点,但是CreateRelationship方法没有支持插入索引关系的签名。

对Neo4jClient的任何帮助都是非常感谢的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-15 09:24:54

您可以使用ReIndex命令来完成它:

代码语言:javascript
复制
if(!GraphClient.CheckIndexExists("relatedto", IndexFor.Relationship))
    GraphClient.CreateIndex("relatedto", ExactIndex, IndexFor.Relationship);

var simple1 = new Simple {Value = "simple_1"};
var simple2 = new Simple { Value = "simple_2" };

var s1Ref = GraphClient.Create(simple1);
var s2Ref = GraphClient.Create(simple2);

var relationship = new RelatedTo(s2Ref){RelationshipValue = "indexed_" + s1Ref.Id};

var relRef = GraphClient.CreateRelationship(s1Ref, relationship);

//Adding to the index
GraphClient.ReIndex(relRef, new []{new IndexEntry("relatedto"){{"value", relationship.RelationshipValue}}});

Console.WriteLine("Use this in N4J Data Browser: rel:index:relatedto:value:{0}", relationship.RelationshipValue);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18248417

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档