code: @GET
    @Path("search/matrix")
    @Produces("text/plain")
    public StreamingOutput matrix(
      final @QueryParam("q") String query,
      final @QueryParam("corpora") String rawCorpusNames,
      @QueryParam("metakeys") String rawMetaKeys,
      @DefaultValue("false") @QueryParam("csv") String rawCsv)
    {
      requiredParameter(query, "q", "AnnisQL query");
      requiredParameter(rawCorpusNames, "corpora",
        "comma separated list of corpus names");
  
      final boolean outputCsv = Boolean.parseBoolean(rawCsv);
      
      Subject user = SecurityUtils.getSubject();
      List<String> corpusNames = splitCorpusNamesFromRaw(rawCorpusNames);
      for (String c : corpusNames)
      {
        user.checkPermission("query:matrix:" + c);
      }
  
      final QueryData data = queryDataFromParameters(query, rawCorpusNames);
  
      MatrixQueryData ext = new MatrixQueryData();
      if(rawMetaKeys != null)
      {
        ext.setMetaKeys(splitMatrixKeysFromRaw(rawMetaKeys));
      }
      if(ext.getMetaKeys() != null && ext.getMetaKeys().isEmpty())
      {
        ext.setMetaKeys(null);
      }
  
      data.addExtension(ext);
  
      StreamingOutput result = new StreamingOutput()
      {
        @Override
        public void write(OutputStream output) throws IOException, WebApplicationException
        {
          long start = new Date().getTime();
          queryDao.matrix(data, outputCsv, output);
          long end = new Date().getTime();
          logQuery("MATRIX", query, splitCorpusNamesFromRaw(rawCorpusNames),
            end - start);
        }
      };
  
      return result;
    }
docs: Get result as matrix in WEKA (ARFF) format.
  @param query
  @param rawCorpusNames
  @param rawMetaKeys
  @param rawCsv
  @return