public void prepare() {
        this.highlightTerms.clear();

        for (String index : getHighlightItems().keySet()) {
            AndItem root = getHighlightItems().get(index);
            List<WordItem> words = new ArrayList<>();
            List<CompositeItem> phrases = new ArrayList<>();
            for (Iterator<Item> i = root.getItemIterator(); i.hasNext(); ) {
                Item item = i.next();
                if (item instanceof WordItem) {
                    words.add((WordItem)item);
                } else if (item instanceof CompositeItem) {
                    phrases.add((CompositeItem)item);
                }
            }

            List<String> terms = new ArrayList<>();
            terms.add(String.valueOf(words.size() + phrases.size()));
            for (WordItem item : words) {
                terms.add(item.getWord());
            }

            for (CompositeItem item : phrases) {
                terms.add("\"");
                terms.add(String.valueOf(item.getItemCount()));
                for (Iterator<Item> i = item.getItemIterator(); i.hasNext(); ) {
                    terms.add(((IndexedItem)i.next()).getIndexedString());
                }
                terms.add("\"");
            }

            if (terms.size() > 1)
                this.highlightTerms.put(index, terms);
        }
    }
Prepares this for binary serialization. For internal use - see {@link com.yahoo.search.Query#prepare}
container-search/src/main/java/com/yahoo/prelude/query/Highlight.java