private void segmentEnd(int i,int j) {
        if (collectTrace)
            metrics.trace().add("    segment ended at: " + i + "->" + j + " (" + query.getTerms()[i] + ")" + "\n");
        SegmentStartPoint startOfNext=segmentStartPoints.get(i + 1);
        if (startOfNext==null)
            segmentStartPoints.set(i+1,new SegmentStartPoint(i+1,j, metrics,this));
        else
            startOfNext.offerHistory(j, metrics, collectTrace);
    }
Registers an end of a segment

@param i the i at which this segment ends
@param j the j at which this segment ends
searchlib/src/main/java/com/yahoo/searchlib/ranking/features/fieldmatch/FieldMatchMetricsComputer.java