private void collectTaggableItems(Item root, List<Item> terms) {
        if (root == null) return;

        if (root instanceof TaggableItem) {
            // This is tested before descending, as phrases are viewed
            // as leaf nodes in the ranking code in the backend
            terms.add(root);
        } else if (root instanceof CompositeItem c) {
            for (Iterator<Item> i = c.getItemIterator(); i.hasNext();) {
                collectTaggableItems(i.next(), terms);
            }
        } else {} // nop
    }
Prepares this for binary serialization. For internal use.
container-search/src/main/java/com/yahoo/search/query/Model.java