private void exploreSegments() {
        if (collectTrace)
            metrics.trace().add("Calculating matches for\n    " + query + "\n    " + field + "\n");

        // Create an initial start point
        SegmentStartPoint segmentStartPoint=new SegmentStartPoint(metrics,this);
        segmentStartPoints.set(0,segmentStartPoint);

        // Explore segmentations
        while (segmentStartPoint!=null) {
            metrics = segmentStartPoint.getMetrics().clone();
            if (collectTrace)
                metrics.trace().add("\nLooking for segment from " + segmentStartPoint + "..." + "\n");
            boolean found=findAlternativeSegmentFrom(segmentStartPoint);
            if (collectTrace)
                metrics.trace().add(found ? "...found segment: " + metrics.getSegmentStarts() + " score: " +
                        metrics.getSegmentationScore() : "...no complete and improved segment existed" + "\n");
            if (!found)
                segmentStartPoint.setOpen(false);
            segmentStartPoint=findOpenSegment(segmentStartPoint.getI());
        }

        metrics = findLastStartPoint().getMetrics(); // these metrics are the final set
        setOccurrenceCounts(metrics);
        metrics.onComplete();
        metrics.setComplete(true);
    }
Finds segment candidates and explores them until we have the best segmentation history of the entire query
searchlib/src/main/java/com/yahoo/searchlib/ranking/features/fieldmatch/FieldMatchMetricsComputer.java