The result of visiting a
Query
with the
QueryContextVisitor
.
Contains a reference to the full and simple
ClauseContext
s.
The
full ClauseContext takes into account all clauses in the Query, and hence may contain a combination
of explicit and implicit projects and issue types.
The
simple ClauseContext only takes into account the project and issue type clauses in the Query,
and hence will only contain explicit projects and issue types.
To understand why we need this distinction, consider the following scenario. A custom field
cf[100]
has only one field configuration for the project
HSP
. There is also another project called
MKY
, for which this custom field is not visible. Consider the query
cf[100] = "a" AND project IN (HSP, MKY)
.
The full ClauseContext is the intersection of the ClauseContexts of the custom field and project clauses. In this case,
the custom field context is implicitly the HSP project with all issue types, since the HSP project is the only
project it is configured for. The project clause's context is explicitly the HSP and MKY projects, since it names
them both. Intersecting these yields the
explicit context of project
HSP with
all issue types. If you think about what kind of results this query could return, this makes sense: the query
could only return issues from project HSP, since only those issues will have values for that custom field.
The simple ClauseContext, on the other hand, is the intersection of the Global Context and the ClauseContexts of the
project and issue type clauses, of which there is only one. (The Global Context gets substituted in place of any
non-project or non-issuetype clauses.) Again, the project clause's context is explicitly the HSP and MKY projects,
since it names them both. Intersecting these yields the
explicit context of projects
HSP and MKY and all issue types.
So, by knowing both of these contexts, we get more information about the query's clauses. The full context tells us more
about what results to expect, but at the same time can hide information about what was originally specified in the
query. The simple context gives us an easy way to figure out what project and issue types were explicitly specified
in the query. This is useful for testing fitness in the filter form.