Hello, guys!
I've tried to query complex geoshape, but got empty response. What am I doing wrong?
My query:
transaction = client.submit(
f"""
g.V().has("location", geoWithin(Geoshape.circle({lat}, {lon}, {radius})))
"""
)
Index creation:
transaction = client.submit(
"""
mgmt = graph.openManagement()
location = mgmt.makePropertyKey('location').dataType(Geoshape.class).cardinality(Cardinality.SINGLE).make()
mgmt.buildIndex('byLocation', Vertex.class).addKey(location, Mapping.PREFIX_TREE.asParameter()).buildMixedIndex('search')
mgmt.commit()
"""
)
Vertex creation:
transaction = client.submit(
f"""
g.addV("place").property("location", {graph_geoshape.to_janus_graph_property()})
"""
)
Schema looks like this:
[ '------------------------------------------------------------------------------------------------\n'
'Vertex Label Name | Partitioned | Static |\n'
'---------------------------------------------------------------------------------------------------\n'
'place | false | false |\n'
'location | false | false |\n'
'---------------------------------------------------------------------------------------------------\n'
'Edge Label Name | Directed | Unidirected | Multiplicity |\n'
'---------------------------------------------------------------------------------------------------\n'
'---------------------------------------------------------------------------------------------------\n'
'Property Key Name | Cardinality | Data Type |\n'
'---------------------------------------------------------------------------------------------------\n'
'location | SINGLE | class org.janusgraph.core.attribute.Geoshape |\n'
'place | SINGLE | class org.janusgraph.core.attribute.Geoshape |\n'
'---------------------------------------------------------------------------------------------------\n'
'Graph Index (Vertex) | Type | Unique | Backing | Key: Status |\n'
'---------------------------------------------------------------------------------------------------\n'
'byLocation | Mixed | false | search | location: ENABLED |\n'
'---------------------------------------------------------------------------------------------------\n'
'Graph Index (Edge) | Type | Unique | Backing | Key: Status |\n'
'---------------------------------------------------------------------------------------------------\n'
'---------------------------------------------------------------------------------------------------\n'
'Relation Index (VCI) | Type | Direction | Sort Key | Order | Status |\n'
'---------------------------------------------------------------------------------------------------\n']
My Vertexes:
V: [{<T.id: 1>: 4096, <T.label: 4>: 'place', 'location': {'@type': 'janusgraph:Geoshape', '@value': {'geometry': {'type': 'LineString', 'coordinates': [[42.546782, 1.699474], [42.546422, 1.699865], [42.545915, 1.700278], [42.545598, 1.700634], [42.545173, 1.701465], [42.544649, 1.703692], [42.544446, 1.705885], [42.544222, 1.708992], [42.544067, 1.711593], [42.543972, 1.71567], [42.543751, 1.722193], [42.543764, 1.723969], [42.543877, 1.725626], [42.544064, 1.726973], [42.544383, 1.728158], [42.544966, 1.729793], [42.545616, 1.73112], [42.546221, 1.732211], [42.54678, 1.733105]]}}}}, {<T.id: 1>: 4136, <T.label: 4>: 'location', 'place': {'@type': 'janusgraph:Geoshape', '@value': {'geometry': {'type': 'LineString', 'coordinates': [[42.546782, 1.699474], [42.546422, 1.699865], [42.545915, 1.700278], [42.545598, 1.700634], [42.545173, 1.701465], [42.544649, 1.703692], [42.544446, 1.705885], [42.544222, 1.708992], [42.544067, 1.711593], [42.543972, 1.71567], [42.543751, 1.722193], [42.543764, 1.723969], [42.543877, 1.725626], [42.544064, 1.726973], [42.544383, 1.728158], [42.544966, 1.729793], [42.545616, 1.73112], [42.546221, 1.732211], [42.54678, 1.733105]]}}}}]
Recources used:
https://docs.janusgraph.org/index-backend/text-search/#geo-mapping