Closed sag3ll0 closed 4 years ago
Actually only the statement
parameter returned in the function is used for generated queries.
So you can either update directly initialQuery.statement
with anythig you want but in this case you'll have to do a string replacement, to keep to other parts of the query, which is not easy to do.
Or regenerate the full statement with the updated whereElements like this:
"filterNodeValueQuery": function (node, initialQuery) {
initialQuery.whereElements.push("Profile.name CONTAINS 'leg'");
initialQuery.statement = "MATCH " + queryMatchElements.join(", ") + ((queryWhereElements.length > 0) ? " WHERE " + queryWhereElements.join(" AND ") : "") + " RETURN " + queryReturnElements.join(", ") + " " + queryEndElements.join(" ");
return initialQuery;
},
This is not a very clean solution, it was introduced to allow this kind of customization.
You'll probably have to update filterNodeCountQuery
and filterNodeRelationQuery
accordingly to avoid inconsistent data.
Another possibility is to use predefined constraints: https://github.com/Nhogs/popoto/wiki/Node-configuration#get-predefined-constraints
Or use a prefilter query using popoto.query.prefilter
which is applied everywhere in query execution
assuming Profile if the root of your query you can do something like this:
popoto.query.prefilter = "MATCH (profile:Profile) WHERE profile.name CONTAINS 'leg' WITH profile ";
I understand and do next
declare global var filterClause = [];
and wrote
"getPredefinedConstraints": () => {
return this.filterClause;
},
on button click (for example) i do next:
filterName(e) {
this.filterClause = ["profile.name CONTAINS 'leg'"];
popoto.tools.reset();
}
its will reset all graph and show profiles according contains.
If don't raise popoto.tools.reset();
and click on profile
node it will return needed rocords, but count is not change (for example 500 instead 10).
Hello and thanks for great project. How i must use filterNodeValueQuery function ? I need filter for node and want use statement "Profile.name CONTAINS 'leg'" i do next
but its not work, i see that initialQuery.statement without my where. and in wiki i dont find information about it.