@ GET @ Produces ( "text/plain" ) @ Path ( "check" ) public String check ( @ QueryParam ( "q" ) String query , @ DefaultValue ( "" ) @ QueryParam ( "corpora" ) String rawCorpusNames ) { Subject user = SecurityUtils . getSubject ( ) ; List < String > corpusNames = splitCorpusNamesFromRaw ( rawCorpusNames ) ; for ( String c : corpusNames ) { user . checkPermission ( "query:parse:" + c ) ; } Collections . sort ( corpusNames ) ; List < Long > corpusIDs = queryDao . mapCorpusNamesToIds ( corpusNames ) ; queryDao . parseAQL ( query , corpusIDs ) ; return "ok" ; }
Return true if this is a valid query or throw exception when invalid