private void inSegment(int i, int j, int previousJ, int previousI) {
        metrics.onPair(i, j, previousJ);
        if (j==previousJ+1 && i==previousI+1) {
            metrics.onInSequence(i, j, previousJ);
        }
        else {
            metrics.onInSegmentGap(i, j, previousJ);
            if (collectTrace)
                metrics.trace().add("      in segment gap: " + i + "->" + j + " (" + query.getTerms()[i] + ")" + "\n");
        }
    }
Returns the semantic distance from a starting point zeroJ to a field index j

@return the semantic distance, or -1 (undefined) if j is -1
searchlib/src/main/java/com/yahoo/searchlib/ranking/features/fieldmatch/FieldMatchMetricsComputer.java