goblin icon indicating copy to clipboard operation
goblin copied to clipboard

How to use mixed index in goblin?

Open StanYaha opened this issue 7 years ago • 4 comments

Hi,Dave. In gremlin shell, i use the composite index like this

g.V().has('id_number', 'xxx').toList()

I can use the goblin like

suspector = await session.traversal(Suspector).has('id_number', 'xxx').toList()

But how can i use the mixed index with goblin? In gremlin shell

g.V().has('age', inside(18,30)).toList()

How can i use the goblin to make this?

StanYaha avatar Jan 10 '18 07:01 StanYaha

Are you asking how to use inside?

from gremlin_python.process.traversal import inside

await session.g.V().has('age', inside(18,30)).toList()

davebshow avatar Jan 15 '18 16:01 davebshow

Did this solution work for you?

davebshow avatar Jan 22 '18 18:01 davebshow

It's not worked!

async def go(loop):
    start = time.time()
    remote_connection = await DriverRemoteConnection.open('ws://localhost:8182/gremlin', 'g')
    g = Graph().traversal().withRemote(remote_connection)
    a = int(1516999699)
    b = int(1517492274)
    vertices =  await g.V().has('datetime',inside(a,b)).toList()

image

StanYaha avatar Feb 09 '18 02:02 StanYaha

>>> from gremlin_python.process.traversal import inside
>>> from gremlin_python import statics
>>> from gremlin_python.structure.graph import Graph
>>> from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
>>> statics.load_statics(globals())
>>> graph = Graph()
>>> g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182','g'))
>>> g.V().has('datetime', inside(1516999699,1517492274)).toList()

This worked!But when i use the async and await,it failed

StanYaha avatar Feb 09 '18 06:02 StanYaha