private void insertTags(HitField field, boolean bolding, boolean dynteaser) {
        boolean insideHighlight = false;
        for (ListIterator<FieldPart> i = field.listIterator(); i.hasNext();) {
            FieldPart f = i.next();
            if (f instanceof SeparatorFieldPart)
                setSeparatorString(bolding, (SeparatorFieldPart) f);
            if (f.isFinal()) continue;

            String toQuote = f.getContent();
            List<FieldPart> newFieldParts = null;
            int previous = 0;
            for (int j = 0; j < toQuote.length(); j++) {
                char key = toQuote.charAt(j);
                switch (key) {
                    case RAW_HIGHLIGHT_CHAR:
                        newFieldParts = initFieldParts(newFieldParts);
                        addBolding(bolding, insideHighlight, f, toQuote, newFieldParts, previous, j);
                        previous = j + 1;
                        insideHighlight = !insideHighlight;
                        break;
                    case RAW_SEPARATOR_CHAR:
                        newFieldParts = initFieldParts(newFieldParts);
                        addSeparator(bolding, dynteaser, f, toQuote, newFieldParts, previous, j);
                        previous = j + 1;
                        break;
                    default:
                        // no action
                        break;
                }
            }
            if (previous > 0 && previous < toQuote.length()) {
                newFieldParts.add(new StringFieldPart(toQuote.substring(previous), f.isToken()));
            }
            if (newFieldParts != null) {
                i.remove();
                for (FieldPart newFieldPart : newFieldParts) {
                    i.add(newFieldPart);
                }
            }
        }
    }
This converts the backend binary highlighting of each item in an array of string field,
and creates a new field that replaces the original.
container-search/src/main/java/com/yahoo/prelude/searcher/JuniperSearcher.java