简体   繁体   中英

Gremlin .Net, filter vertices by property containing a value

I need to filter vertices in Azure Cosmos Graph DB by a property containing a value, I tried the code below but I am getting an error says (Unable to find any method 'filter')

var g = client.CreateTraversalSource();
var p = new P("containing", text);
var query = g.V().Filter(p).Range<Vertex>(page, pageSize);

var result = await client.ExcuteAsync<IEnumerable<Vertex>>(query);

Any idea how to achieve this?

This might help someone else, I managed to figure it out with some help of a friend:

var p = new P("containing", text);
var query = g.V().has("propertyName", p).Range<Vertex>(page, pageSize);
var result = await client.ExecuteAsync<IEnumerable<Vertext>>(query);

In case anyone is still looking into this, there's predefined predicate values that can be used as string filters in the class TextP.

var query = g.V().has("propertyName", TextP.Containing(text)).Range<Vertex>(page, pageSize);
var result = await client.ExecuteAsync<IEnumerable<Vertext>>(query);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM