public FieldMatchMetrics compute(Query query, Field field, boolean collectTrace) {
        // 1. Reset state
        this.collectTrace = collectTrace;
        this.query = query;
        this.field = field;
        segmentStartPoints.clear();
        for (int i = 0; i <= query.getTerms().length; i++)
            segmentStartPoints.add(null);
        alternativeSegmentationsTried = 0;
        metrics = new FieldMatchMetrics(this);

        // 2. Compute
        exploreSegments();
        return metrics;
    }
Computes the string match metrics from a query and field.

@param query the query to compute over
@param field the field value to compute over
@param collectTrace true to accumulate trace information in the trace returned with the metrics
searchlib/src/main/java/com/yahoo/searchlib/ranking/features/fieldmatch/FieldMatchMetricsComputer.java