@Test
    public void testAbsoluteOccurrence() {
        assertMetrics("absoluteOccurrence:0",  "a","x");
        assertMetrics("absoluteOccurrence:0.01","a","a");
        assertMetrics("absoluteOccurrence:0","a a a","x");
        assertMetrics("absoluteOccurrence:0.01",  "a a a","a");
        assertMetrics("absoluteOccurrence:0.03",  "a a a","a a a");
        assertMetrics("absoluteOccurrence:0.04",  "a a a","a a a a");
        assertMetrics("absoluteOccurrence:0.05","a","x x x a x x a x a x x x a a");
        assertMetrics("absoluteOccurrence:0.14","a","a a a a a a a a a a a a a a");
        assertMetrics("absoluteOccurrence:0.07","a b","a b b a a a a a b a a b a a");

        // tests going beyond the occurrence limit
        FieldMatchMetricsParameters parameters=new FieldMatchMetricsParameters();
        parameters.setMaxOccurrences(10);
        parameters.freeze();
        FieldMatchMetricsComputer c=new FieldMatchMetricsComputer(parameters);
        assertMetrics("absoluteOccurrence:0.6","a b","a a a a a a a a a a b b",false,c);
        assertMetrics("absoluteOccurrence:0.6","a b","a a a a a a a a a a a b b",false,c); // Starting to cut off
        assertMetrics("absoluteOccurrence:0.6","a b","a a a a a a a a a a a a a a a a a a a a a b b",false,c); // Way beyond cutoff for a
        assertMetrics("absoluteOccurrence:1",  "a b","a a a a a a a a a a b b b b b b b b b b",false,c); // Exactly no cutoff
        assertMetrics("absoluteOccurrence:1",  "a b","a a a a a a a a a a a b b b b b b b b b b b",false,c); // Field is too large to consider field length
    }
Calculated the same way as weight
searchlib/src/test/java/com/yahoo/searchlib/ranking/features/fieldmatch/test/FieldMatchMetricsTestCase.java