Understanding Query Operator Precedence in the EloView 4 Query Engine
Our query engine follows standard operator precedence rules when processing conditions. Operators are always evaluated in the following order:
- Parentheses/Brackets
- NOT
- AND
- OR
This means that when a query contains both AND and OR without parentheses, the system will always evaluate all AND conditions before applying any OR conditions.
Example: How Operator Precedence Affects Your Query
Original Query
name:"POS" and name:"Y052016" or name:"Y052051" or name:"Y300084" or name:"Y351040"How the Engine Interprets It
Because AND is evaluated before OR, the query is treated as:
(name:"POS" and name:"Y052016") or name:"Y052051" or name:"Y300084" or name:"Y351040"Result
This will return:
- Items that contain both POS and Y052016, or
- Any items that match Y052051, Y300084, or Y351040 — even if they don’t contain POS.
How to Get the Intended Results
If your goal is to require POS for all Y-values, you should use parentheses to group your OR conditions:
name:"POS" and (name:"Y052016" or name:"Y052051" or name:"Y300084" or name:"Y351040")This ensures that POS applies to all the grouped Y-values.
Additional Example
Original Query
name:"pos" AND name:"store1" OR name:"store2" OR name:"store3" AND name:"KDS"Interpreted by the System
(name:"pos" AND name:"store1") OR name:"store2" OR (name:"store3" AND name:"KDS")This logic may produce unexpected results because the OR conditions aren’t grouped properly.
Intended Behavior
If you want to find results that:
- Contain POS in the name
- Include one of the following: Store1, Store2, or Store3
- Also contain KDS
You should write the query like this:
name:"pos" AND (name:"store1" OR name:"store2" OR name:"store3") AND name:"KDS"Best Practice
When combining AND and OR:
- Always use parentheses to group your conditions.
- This ensures your intended logic is clear and prevents unexpected results.
- ⚠️ Some existing filters may not work under the new logic and will need to be recreated.
By explicitly grouping terms, your queries will behave consistently and return accurate results every time.
Please report any broken links by emailing support@elotouch.com and include a link to the knowledge article