this code not run , it thow exception. if ls1 not found.
{
ls1 as var(func: has(product_category ))
@filter(
regexp(product_productname, /samsung-nonExits data.*/i)
)
{
product_category{
uid
}
uid ,
cat1 as product_categoryid,
r1 as math(cond(cat1 == 42, 1,0 )),
score1 as math(100+r1)
}
ls2 as var(func: has(product_category ))
@filter(
alloftext(product_productname, "samsung")
)
{ product_category{
uid
}
uid ,
cat2 as product_categoryid,
r2 as math(cond(cat2 == 42, 1,0 )),
score2 as math(10+r2)
}
ls3 as var(func: has(product_category))
@filter(
anyoftext(product_productname, "samsung")
)
{
product_category{
uid
}
uid ,
cat3 as product_categoryid,
r3 as math(cond(cat3 == 42, 1,0 )),
score3 as math(3+r3)
}
lsall as var(func: uid( ls1,ls3, ls2) ) {
uid,
score as math(score1+score2+score3) ,
catlistX as product_category {
category_categoryid,
uid
}
}
#----------------
rs as var(func: uid( catlistX ) ) {
uid,
~product_category @filter( uid( lsall) )
{
m1 as product_productid
# m0 as math(product_productid)
c as count(product_productid),
r as math(1)#cond(m1 == 23369, 1,0)),
# scorex as math(score)
}
m as min(val(m1)),
xx as sum(val(c)) ,
sr as sum(val(r))
}
catelist(func: uid( rs )
,first:100 ,orderdesc: val(xx) ) # @filter( eq(val(sr), 0) #filter again
{
category_categoryid,
category_categoryname
uid,
val(xx),
val(m),
val(sr)
}
sanpham(func: uid( lsall )
,first:15 ,orderdesc: val(score ) )
{
product_categoryid
product_productname,
product_contentsrh
uid,
val(score),
product_category {
category_categoryname
category_categoryid
}
}
}