Pass Node property dynamically to query as input while filtering

Hi Team,

I would like to pass the vertex attribute dynamically to use in the where clause. Like below example. Please let me know if there is any way

CREATE QUERY autocomplete_property_search(string searchterm, string property, set labelnames) FOR GRAPH movies syntax v2{
MapAccum<STRING, SetAccum> @@nodeids;
string vall;
vall = “%”+ searchterm + “%”;
start = {ANY} ;
if labelnames.size() > 0 then
pp = select p from start:p where p.type in labelnames and p.property like vall;
ELSE
pp = select p from start:p where p.property like vall;
end;
print @@nodeids;
}

The error says "No type can be inferred for “p.property”. I would like to send the attribute name to query as input. In this case if I send property = Name, the query should do filtering on p.Name like vall;

you can use getAttr():

pp = select p from start:p where p.type in labelnames and p.property like vall;

change to

pp = select p from start:p where p.type in labelnames and p.getAttr(property,"string") like vall;

No, its not working. It says no type can be inferred for p.getAttr(property, “string”)

Looks like above solution works for syntax v1, but not for syntax v2. Any idea about the reason behind

@karnamthulasiram Looks like there might be a bug with the type/error checking. It should work with v1 and v2. Does it let you install with v2 even if it throws and error message?