2

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?

Vipul Prajapati
  • 1,183
  • 9
  • 11
Olivertem
  • 31
  • 2

1 Answers1

2

It is correct that the comma-separated q StringFilter items are ANDed together. As far as I remember, we never implemented any OR for StringFilters.

To achieve what you want I'd propose to do two queries and merge the results. Sorry ...

The spec is here. It says clearly:

The Simple Query Language provides a simplified syntax to retrieve entities which match a set of conditions. A query is composed by a list of statements separated by the ';' character. Each statement expresses a matching condition. The query returns all the entities that match all the matching conditions (AND logical operator).

kzangeli
  • 403
  • 2
  • 8