private void connectLastTermsIn(CompositeItem composite) {
        int items = composite.items().size();
        if (items < 2) return;
        Item nextToLast = composite.items().get(items - 2);
        if (nextToLast instanceof AndSegmentItem) {
            var subItems = ((AndSegmentItem) nextToLast).items();
            nextToLast = subItems.get(subItems.size() - 1);
        }
        if ( ! (nextToLast instanceof TermItem)) return;
        Item last = composite.items().get(items - 1);
        if (last instanceof AndSegmentItem) {
            last = ((AndSegmentItem) last).items().get(0);
        }
        if (last instanceof TaggableItem) {
            TermItem t1 = (TermItem) nextToLast;
            t1.setConnectivity(last, 1);
        }
    }
Returns a word, a phrase, or another composite
container-search/src/main/java/com/yahoo/prelude/query/parser/StructuredParser.java