▲ | jraph 3 days ago | |||||||
> JQL only lets you write severely limited "where" clauses that plug into something that probably isn't SQL at all. That's right. JQL (Jira Query Language) is based on AQL (Atlassian Query Language), same as CQL (Confluence Query Language), and targets Lucene (IIRC), not SQL, and CQL and JQL are (I suppose!) translated to Lucene queries. These query languages are a subset of what you can do with a Solr / Lucene query string (basically the same thing as Solr is a fork of Lucene; Lucene is what is behind Atlassian products' search features IIRC). If you squint a little, you can liken it to some limited SQL where clause without the joins and the sub queries, but the target is a search platform, not an SQL database. AQL fields map to Lucene fields, and there are functions that are also (likely) translated to Lucene expressions or replaced with some stuff from the context (currentContent() for instance in CQL is replaced to the id of the current Confluence page, and parentContent() to the id of the parent of the current page - again, this is a guess). I suppose they invented this family or query languages to provide something more high level / user-friendly than raw lucene query strings, or possibly didn't want to give full access to the Lucene search capabilities for some reason. There are Maven packages provided by Atlassian to deal with AQL [1], but they are not open source (and I have not studied their code, disassembled or otherwise). I have reimplemented an AQL parser [2] from scratch using their limited docs and guesses, and, with this, implemented a CQL to Solr query translator for XWiki, mapping Confluence features to corresponding XWiki features [3]. Because people are migrating from Confluence to XWiki and their content is sprinkled with CQL-based macros that we needed to make work. If you are curious about how a CQL statement can be translated to a Solr query (although querying fields in XWiki, not Confluence), you can look at the tests [4]. I actually find AQL pretty elegant, although I'll admit I haven't used it much. [1] https://mvnrepository.com/artifact/com.atlassian.querylang [2] https://github.com/xwiki-contrib/cql/tree/master/aqlparser [3] https://github.com/xwiki-contrib/cql/tree/master/query [4] https://github.com/xwiki-contrib/cql/blob/master/query/src/t... | ||||||||
▲ | pas 3 days ago | parent [-] | |||||||
thanks for the links, and ... uhh, mad respect on the xwiki CQL feature! :) a bit tangential, but isn't Solr (and ElasticSearch and probably others) all use Lucerne "indexes" (as in Lucene is a library like LevelDB)? what's strange is that most JQL that people want would translate to the most boring Hibernate query (or whatever Jira uses for relational DB access) | ||||||||
|