我正在尝试使用jsonPath和pick函数来确定是否需要根据当前域运行规则.我正在做的简化版本是:
global
{
dataset shopscotchMerchants <- "https://s3.amazonaws.com/app-files/dev/merchantJson.json" cachable for 2 seconds
}
rule checkdataset is active
{
select when pageview ".*" setting ()
pre
{
merchantData = shopscotchMerchants.pick("$.merchants[?(@.merchant=='Telefora')]");
}
emit
<|
console.log(merchantData);
|>
}
Run Code Online (Sandbox Code Playgroud)
我期望的控制台输出是telefora对象,而是从json文件中获取所有三个对象.
如果不是商家=='Telefora'我使用merchantID == 16那么它的效果很好.我认为jsonPath也可以匹配字符串.虽然上面的例子没有搜索json的merchantDomain部分,但我遇到了同样的问题.