Document Filter
A condition on a whole document, which limits a JsonPathQuery to the documents that meet it (JsonPathQuery.documentFilter, SPEC.md §10.5): an RFC 9535 logical expression, what a filter selector holds after its ?, evaluated once on each document with both @ and $ standing for the document's root.
@.kind == 'order' && @.version >= 2 keeps the documents whose root has those members, which a path alone can't say: RFC 9535 filters test the children of a node, never the root itself. The whole filter grammar applies: comparisons, existence tests, !, &&, ||, parentheses, queries with nested filters, and the functions of JsonPath. A comparison of a root member with a literal narrows the search through the index as the path's own filters do.
Compile once, then use it in any number of queries. Immutable and thread-safe; two filters are equal when their texts are.
Properties
What in the filter is valid but can't be what was meant, in the order of the text, as JsonPath.warnings has for a query; offsets are in the filter's text.