Search

DSE Graph can use search indexes that take advantage of DSE Search functionality for efficient traversal queries. Here is the list of additional search predicates:

Text tokenization:

Text match:

Geo:

Create search indexes

For text tokenization:

s.execute_graph("schema.vertexLabel('my_vertex_label').index('search').search().by('text_field').asText().add()")

For text match:

s.execute_graph("schema.vertexLabel('my_vertex_label').index('search').search().by('text_field').asString().add()")

For geospatial:

You can create a geospatial index on Point and LineString fields.

s.execute_graph("schema.vertexLabel('my_vertex_label').index('search').search().by('point_field').add()")

Using search indexes

Token:

from dse_graph.predicates import Search
# ...

g = DseGraph.traversal_source()
query = DseGraph.query_from_traversal(
    g.V().has('my_vertex_label','text_field', Search.token_regex('Hello.+World')).values('text_field'))
session.execute_graph(query)

Text:

from dse_graph.predicates import Search
# ...

g = DseGraph.traversal_source()
query = DseGraph.query_from_traversal(
    g.V().has('my_vertex_label','text_field', Search.prefix('Hello')).values('text_field'))
session.execute_graph(query)

Geospatial:

from dse_graph.predicates import Geo
from dse.util import Distance
# ...

g = DseGraph.traversal_source()
query = DseGraph.query_from_traversal(
    g.V().has('my_vertex_label','point_field', Geo.inside(Distance(46, 71, 100)).values('point_field'))
session.execute_graph(query)

For more details, please refer to the official DSE Search Indexes Documentation