Python Language Neo4j and Cypher using Py2Neo Query 1 : Autocomplete on News Titles


def get_autocomplete(text):
    query = """
    start n = node(*) where =~ '(?i)%s.*' return,labels(n) limit 10;
    query = query % (text)
    obj = []
    for res in graph.cypher.execute(query):
        # print res[0],res[1]
    return res

This is a sample cypher query to get all nodes with the property name that starts with the argument text.