Hi everyone,
I write a simple query to count unique products by the customer
CREATE QUERY recommend(/* Parameters here */) FOR GRAPH DATA{
SumAccum<int> @product_cnt = 0 ;
Others1 =
SELECT c1
FROM customer:c1
where c1.name!=""
limit 20;
Others2=SELECT c1
FROM product:p-(transaction) - Others1:c1
PER(c1,p)
ACCUM c1.@product_cnt += 1;
print Others2;
}
This is result, @product_cnt=0:
{
"attributes": {
"@bought": false,
"@product_cnt": 0,
"name": "23194432"
},
"v_id": "23194432",
"v_type": "customer"
}
When I remove PER clause this is result, @product_cnt=525:
{
"attributes": {
"@product_cnt": 525,
"name": "23194432"
},
"v_id": "23194432",
"v_type": "customer"
}
Is there any problem in my code PER clause?