@Override
    public void beginResponse(OutputStream stream) {
        Charset cs = Charset.forName(getRequestedEncoding(getResult().getQuery()));
        CharsetEncoder encoder = cs.newEncoder();
        writer = wrapWriter(new ByteWriter(stream, encoder));

        header(writer, getResult());
        if (getResult().hits().getError() != null || getResult().hits().getQuery().errors().size() > 0)
            error(writer, getResult());

        if (getResult().getContext(false) != null)
            queryContext(writer, getResult().getQuery());
    }
Writes a hit's default attributes like 'type', 'source', 'relevance'.
container-search/src/main/java/com/yahoo/search/pagetemplates/result/PageTemplatesXmlRenderer.java