protected void insertMatch(RuleEvaluation e, Match matched, List<Item> newItems, int offset) {
        if (getWeight() != 100)
            newItems.forEach(item -> item.setWeight(getWeight()));
        int insertPosition = matched.getPosition() + offset;

        // This check is necessary (?) because earlier items may have been removed
        // after we recorded the match position. It is sort of hackish. A cleaner
        // solution would be to update the match position on changes
        if (insertPosition > matched.getParent().getItemCount()) {
            insertPosition = matched.getParent().getItemCount();
        }

        e.insertItems(newItems, matched.getParent(), insertPosition, getTermType(), replacing);
        if (e.getTraceLevel() >= 6)
            e.trace(6, "Inserted items '" + newItems + "' at position " + insertPosition + " producing " +
                       e.getEvaluation().getQuery().getModel().getQueryTree());
    }
Inserts newItems at the position of this match
TODO: Move to ruleevaluation
container-search/src/main/java/com/yahoo/prelude/semantics/rule/TermProduction.java