public int encode(ByteBuffer buffer) {
        if (getRoot() == null) return 0;
        return getRoot().encode(buffer);
    }
The root node of a query tree. This is always present above the actual semantic root to ease query manipulation,
especially replacing the actual semantic root, but does not have any search semantics on its own.

<p>To ease recursive manipulation of the query tree, this is a composite having one child, which is the actual root.
<ul>
<li>Setting the root item (at position 0, either directly or though the iterator of this, works as expected.
Setting at any other position is disallowed.
<li>Removing the root is allowed and causes this to be a null query.
<li>Adding an item is only allowed if this is currently a null query (having no root)
</ul>

<p>This is also the home of accessor methods which eases querying into and manipulation of the query tree.</p>

@author Arne Bergene Fossaa
container-search/src/main/java/com/yahoo/search/query/QueryTree.java