Gremlin.net textContains equivalent

2019-07-20 22:28发布

问题:

I am using Gremlin.net library to connect to a janus graph server. I am usin cassandra and elasstic search for data storage and indexing. In gremlin language and gremlin console I use textContains to search within the text of a property. I am using Mixed index for that, but I can find the equivalent for that in Gremlin.net Library? can anyone help?

回答1:

Gremlin.Net will not have that. TinkerPop doesn't have text or geo search predicates that JanusGraph and other systems have. At this point, we leave it to graph providers to develop such extensions. Unfortunately, I'm not aware of any that have done that for all the Gremlin Language Variants like C#, Javascript, etc. I think that DSE Graph is the only graph provider to do that at this point.



回答2:

JanusGraph now has a library that extends Gremlin.Net for aspects that are specific to JanusGraph: JanusGraph.Net.

This library already contains text predicates. So, you can now do this directly in C#:

var songName = g.V().Has("song", "name", Text.TextContains("COMES")).Values<string>("name").Next();
Console.WriteLine(songName); // output: HERE COMES SUNSHINE