0

What is the correct way to utilize a previously created vertex index within a traversal?

I want find the vertex with a specific key/value. I thus created a unique index on a specific vertex class.

My traversal works but I have the feeling index is not being utilized (I inspected the call tree)

Vertex v = getGraph().getRawTraversal().V().has("testkey", P.eq("testvalue")).next();

My main reference are orientdb-gremlin unit tests:

https://github.com/orientechnologies/orientdb-gremlin/blob/58e604b1b5f5d26e545f7a4beb9640b8a342d822/driver/src/test/java/org/apache/tinkerpop/gremlin/orientdb/OrientGraphIndexTest.java#L157

The main doc does not yet contain any references to index usage. (Presumable because 3.x has not yet been released)

https://orientdb.com/docs/3.0.x/tinkerpop3/OrientDB-TinkerPop3.html

Jotschi
  • 3,270
  • 3
  • 31
  • 52
  • I'm not too familiar with orientdb-gremlin, but can you try chaining the `.profile()` step at the end of your traversal for more output? See http://tinkerpop.apache.org/docs/3.2.5/reference/#profile-step for more info. – jbmusso Oct 08 '17 at 12:50
  • The profile step just yields that the OrientGraphStep is utilized. I was able to figure out that I needed to also include the Vertex class name in the has() step. Now it seems that the index is used. – Jotschi Oct 08 '17 at 13:49
  • Hi Jotschi which version are you using? m2 or the snapshot? The documentation is still in draft since it hasn't been out yet the 3.x. – wolf4ood Oct 08 '17 at 16:44
  • 3.0.0m2 - I have also some issues with unique edge constraints. I can't get those to work properly. – Jotschi Oct 08 '17 at 16:52

0 Answers0