Csomópontok keresése minta-illesztéssel

Csomópontok keresése minta-illesztéssel #

Probléma #

Hogyan tudok keresni, vagy szűrni szövegminta-illesztéssel? Például, hogyan tudom megtalálni azokat a filmeket, amelyek címében megtalálható a ".*Lord of.*" szövegtöredék?

Megoldás #

Gizmo Query regex()-el #

g.V().Has("<type>","</film/film>").Out("<name>").Filter(like("%Lord of %")).All()


Eredmények:

{"id":"Greystoke - The Legend of Tarzan, Lord of the Apes"}
{"id":"Lord of Illusions"}
{"id":"Lord of the Beans"}
{"id":"Lord of the Flies"}
{"id":"Lord of War"}
{"id":"Phantasm III: Lord of the Dead"}
{"id":"The Lord of the Rings"}
{"id":"The Lord of the Rings: The Fellowship of the Ring"}
{"id":"The Lord of the Rings: The Return of the King"}
{"id":"The Lord of the Rings: The Two Towers"}

Gizmo Query with like()-kal #

g.V().Has("<type>","</film/film>").Out("<name>").Filter(like("%Lord of the Rings%")).All()

Eredmények:

{"id":"The Lord of the Rings"}
{"id":"The Lord of the Rings: The Fellowship of the Ring"}
{"id":"The Lord of the Rings: The Return of the King"}
{"id":"The Lord of the Rings: The Two Towers"}