public int encode(ByteBuffer buffer) {
        return model.getQueryTree().encode(buffer);
    }
Encodes this query tree into the given buffer

@param buffer the buffer to encode the query to
@return the number of encoded query tree items
container-search/src/main/java/com/yahoo/search/Query.java