@GET @Path("search/find") @Produces("application/xml") public List<Match> find( @QueryParam("q") String query, @QueryParam("corpora") String rawCorpusNames, @DefaultValue("0") @QueryParam("offset") String offsetRaw, @DefaultValue("10") @QueryParam("limit") String limitRaw) throws IOException { requiredParameter(query, "q", "AnnisQL query"); requiredParameter(rawCorpusNames, "corpora", "comma separated list of corpus names"); Subject user = SecurityUtils.getSubject(); List<String> corpusNames = splitCorpusNamesFromRaw(rawCorpusNames); for (String c : corpusNames) { user.checkPermission("query:find:" + c); } int offset = Integer.parseInt(offsetRaw); int limit = Integer.parseInt(limitRaw); QueryData data = queryDataFromParameters(query, rawCorpusNames); data.setCorpusConfiguration(annisDao.getCorpusConfiguration()); data.addExtension(new LimitOffsetQueryData(offset, limit)); long start = new Date().getTime(); List<Match> matches = annisDao.find(data); long end = new Date().getTime(); logQuery("FIND", query, splitCorpusNamesFromRaw(rawCorpusNames), end - start); return matches; }
@GET @Path("corpora/{top}/config") @Produces("application/xml") public CorpusConfig corpusconfig(@PathParam("top") String toplevelName) { Subject user = SecurityUtils.getSubject(); user.checkPermission("query:config:" + toplevelName); Map<String, String> tmp = annisDao.getCorpusConfiguration(toplevelName); CorpusConfig result = new CorpusConfig(); result.setConfig(tmp); return result; }