Design of the CQL module
Reference
In this document, we discuss the design decisions and considerations of the CQL module, including the AQL parser and the CQL query module.
What we know about the Confluence Query Language by looking around
The Confluence Query Language (CQL) is a flavor of the Atlassian Query Language (AQL), which the Jira Query Language (JQL) is probably the most well-known flavor.
Atlassian's implementation is under the Atlassian 3.0 End User License Agreement, which not a free software license. We didn't find any third party implementation of CQL nor AQL, so we had to build our own ourself, using the end-user public documentation available and guesses, and without using decompilation. We did not attempt to peek at the downloadable JAR package which likely hint at some of the parser structure, the parser being written using ANTLR4 (as evidenced by the dependencies of their atlassian-query-lang maven package, on which their Confluence CQL Plugin package depends), since it was not strictly necessary, and since it could probably have put us in legal trouble (even if decompiling and reverse engineering binaries is legal for interoperability purposes in France, where this work was done).
General architecture
We have an AQL parser that is capable of parsing CQL queries, and also JQL queries as well as other flavors of AQL (although we haven't tested this, and this will likely require some improvements to the parser).
We use this parser to convert CQL queries to an AST that we then convert to a Solr expression in our query module.