首页 > 解决方案 > Query entities by the logical operator OR with Fiware Orion

问题描述

I dont be able to retrieve entities form Orion querys with 2 conditions by the logical operator OR.

For example, if I want to retrieve the entities that have temperature > 20 OR humidity enter code here< 50. But I only can retrieve the query by the logical operator AND:

http:// localhost:1026/v2/entities?q=temperature>20;humidity<50 

Also I try with | to separate the conditions, like this:

http:// localhost:1026/v2/entities?q=temperature>20|humidity<50 

But gived me the next error:

{
    "error": "BadRequest",
    "description": "forbidden characters in String Filter"
}

How I could to retrieve queries to Orion by te logical operator OR?

标签: fiwarefiware-orion

解决方案


正确的是逗号分隔的q StringFilter项目是 ANDed 在一起。据我记得,我们从未为 StringFilters 实现任何 OR。

为了实现你想要的,我建议做两个查询并合并结果。对不起 ...

规格在这里。它清楚地说:

简单查询语言提供了一种简化的语法来检索与一组条件匹配的实体。查询由以“;”分隔的语句列表组成 特点。每个语句都表示一个匹配条件。查询返回匹配所有匹配条件(AND 逻辑运算符)的所有实体。


推荐阅读