Document Filtering Overview
applyCurrentDocumentTo Constraint
TheapplyCurrentDocumentTo constraint property in the sheet configuration restricts query results to items within the current LiveDoc. It can target the root entity type or a downstream (related) entity type.
| Property | Type | Default | Description |
|---|---|---|---|
constraints.applyCurrentDocumentTo | string | null | Entity type name to apply current document filtering. When set, the specified entity type is filtered to only include items from the same document as the current Polarion document context. |
Root Entity Filtering
WhenapplyCurrentDocumentTo matches the root query.from entity type, the filter is applied directly to the primary query:
Downstream Entity Filtering
WhenapplyCurrentDocumentTo targets a related entity type (not the root), the constraint applies to the downstream entity:
SystemRequirement entities are filtered to only those within the current document, while UserNeed entities are not document-constrained.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
currentDoc | string | null | Full document path in folder/name format. Set automatically from the Powersheet widget’s document context. |
currentDocConstraint | string | null | Entity type name or expansion path that should be document-filtered. Derived from applyCurrentDocumentTo configuration. |
document.id | string | null | Full document path (folder/name) added as a query parameter for dynamic value resolution. |
The query manager automatically injects document context parameters into all queries. These parameters do not need to be set manually in the sheet configuration.
Document Filter Injection
The query manager applies document filtering by injecting predicates into thewhere clause:
- The
defaultQueryFragmentis computed once from the data source configuration - For each query, the fragment is merged into the query via deep-left merge
- If
currentDocConstraintmatches the query’sfromentity type,document.moduleFolderanddocument.moduleNamepredicates are injected into thewhereclause
| Injected Predicate | Lucene Equivalent | Purpose |
|---|---|---|
document.moduleFolder | document.moduleFolder:"Space" | Filter by document folder/space |
document.moduleName | document.moduleName:"DocName" | Filter by document name |
Document Query Construction
For server-side document resolution, the query engine constructs Lucene queries to find specific documents:| Input | Format | Example |
|---|---|---|
| Project ID + document path | Space/DocumentName | Requirements/SystemReqs |
| Lucene query | project.id:"proj" AND moduleFolder:"Space" AND moduleName:"DocName" | Full resolution query |
The document query format expects
Space/DocumentName and splits on the slash character to build separate moduleFolder and moduleName predicates. Verify document path formats match your Polarion project structure.Constraint Propagation
Document constraints from entity types propagate to related navigation properties:| Source | Propagation Rule |
|---|---|
| Entity type constraints | Extracted from constraint annotations on the entity type |
| Navigation property constraints | Merged from both the navigation property annotation and the target entity type annotation |
| Combined result | AND-combined predicate validated against entity type metadata |
Domain Model Constraint Configuration
Document constraints can be defined at the entity type level in the domain model YAML:| Constraint Type | Purpose |
|---|---|
load.document | Filters entities during initial data loading |
pick.document | Filters entities in picker dropdown selections |
create.document | Sets default document values for new entities |
Complete YAML Example
Related Pages
- Project Scoping — project-level query restrictions
- Query Context — query parameter reference
- Constraints — domain model constraint definitions
- Sources — data source configuration
- Lucene Integration — Lucene query syntax
Source context: PolarionQueryProcessor, QueryManager, QueryFactory, constraints YAML fixtures
Sources
Sources
Source Code
PolarionQueryProcessor.javaprod-powersheet-src/com.nextedy.powersheet.client/src/modules/QueryManager/QueryManager.tsxQueryFactory.javaprod-powersheet-src/com.nextedy.powersheet.client/cypress/e2e/userFlows/multiple-entity-type-flow.cy.tsprod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/models/constraints-base.yaml