Query Translation Overview
Predicate-to-Lucene Mapping
The query processor converts predicates from entity queries into Lucene syntax. The following table documents the confirmed mappings.| Predicate Type | Entity Query Syntax | Lucene Output |
|---|---|---|
| Equality (string) | { 'name': 'John' } | name:"John" |
| Equality (numeric) | { 'count': 5 } | count:5 |
| Object ID (simple) | { 'objectId': 'WI-123' } | id:"WI-123" |
| Object ID (with project) | { 'objectId': 'elibrary/WI-123' } | (project.id:"elibrary" AND id:"WI-123") |
Inequality (!=) | { 'status': { 'ne': 'closed' } } | NOT status:"closed" |
| Null check | { 'title': null } | NOT HAS_VALUE:title |
| Not-null check | { 'title': { 'ne': null } } | HAS_VALUE:title |
| AND composite | { 'and': [...] } | (expr1) AND (expr2) |
| OR composite | { 'or': [...] } | (expr1) OR (expr2) |
| NOT (unary) | { 'not': { ... } } | NOT (expr) |
Lucene Query Prefixes
| Prefix | Lucene Fragment | Purpose |
|---|---|---|
QUERY_TYPE_PREFIX | type: | Filters entities by work item type |
QUERY_PROJECT_PREFIX | AND project.id: | Appends project-scoping constraint |
Type Filtering
type: followed by the Polarion work item type mapped from the entity type’s polarionType property. See Polarion Type Mapping for entity-to-type mapping details.
Project Scoping
The query resolver automatically appendsproject.id:<projectId> to all queries when executing in a project-scoped context. This ensures results are restricted to the current project. See Project Scoping for details.
Query Execution
The query resolver executes translated Lucene queries against Polarion’s persistence layer via theIDataService.searchInstances method.
| Parameter | Type | Description |
|---|---|---|
prototype | string | Polarion object prototype (e.g., work item prototype) |
luceneQuery | string | Translated Lucene query string |
limit | integer | Maximum results. Value -1 retrieves all matching results (unlimited) |
Debug Logging
Powersheet logs executed Lucene queries with structured debug output for troubleshooting.| Log Field | Description |
|---|---|
| Prototype | The Polarion object prototype being queried |
| Query string | The complete Lucene query sent to Polarion |
| Result count | Number of matching entities returned |
| Item preview | First 5 item IDs from the result set (for larger result sets, shows count summary) |
Enable debug logging in the Polarion server configuration to see query execution details. Consult your Polarion administrator for log access.
HAS_VALUE Pseudo-Field
Polarion uses theHAS_VALUE pseudo-field to test whether a property has any value assigned.
Composite Query Precedence
Nested composite predicates maintain correct operator precedence through recursive parenthesization.ID-Based Queries
The query engine can convert resolved query results into ID-based Lucene filters for efficient secondary queries.| Pattern | Lucene Output | Notes |
|---|---|---|
| Project IDs | project.id:"proj1" OR project.id:"proj2" | From resolved project query |
| Document IDs | document.id:"Space/DocName" | Space prefix prepended unless _default space |
| Empty results | Returns unresolvable query constant | Ensures empty results rather than fetching all |
Document IDs in Lucene queries include the space prefix (e.g.,
Requirements/MyDoc). The _default space is omitted from the prefix.Complete YAML Example
where clause uses Lucene syntax directly. The type: prefix filters by Polarion work item type, and HAS_VALUE:title excludes items without a title.
Related Pages
- Predicates — entity query predicate syntax
- Operators — comparison and logical operators
- Query Splitting — how predicates split between Lucene and post-filters
- Project Scoping — automatic project ID filtering
- Document Filtering — document-level query constraints
Source context: GenericQueryResolver, QueryFactory, QueryToLuceneTest, PowersheetConstants
Sources
Sources
Source Code
GenericQueryResolver.javaQueryFactory.javaPolarionQueryProcessor.javaQueryToLuceneTest.javaprod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/constraints_currentDocument_downstream.template.yaml