public static Features compute(Map<String, Integer> queryTerms, Item[] field) {
        double completeness = 0;
        double fieldCompleteness = 0;
        double queryCompleteness = 0;
        double elementWeight = 0;

        double queryTermWeightSum = sum(queryTerms.values());

        for (Item item : field) {
            String[] itemTokens =item.value().split(" ");
            int matchCount = 0;
            int matchWeightSum = 0;
            for (String token : itemTokens) {
                Integer weight = queryTerms.get(token);
                if (weight == null) continue;
                matchCount++;
                matchWeightSum += weight;
            }
            double itemFieldCompleteness = (double)matchCount / itemTokens.length;
            double itemQueryCompleteness = matchWeightSum / queryTermWeightSum;
            double itemCompleteness =
                    fieldCompletenessImportance * itemFieldCompleteness +
                    (1 - fieldCompletenessImportance) * itemQueryCompleteness;
            if (itemCompleteness > completeness) {
                completeness = itemCompleteness;
                fieldCompleteness = itemFieldCompleteness;
                queryCompleteness = itemQueryCompleteness;
                elementWeight = item.weight();
            }
        }

        Map<String, Value> features = new HashMap<>();
        features.put("completeness", new DoubleValue(completeness));
        features.put("fieldCompleteness", new DoubleValue(fieldCompleteness));
        features.put("queryCompleteness", new DoubleValue(queryCompleteness));
        features.put("elementWeight", new DoubleValue(elementWeight));
        return new Features(features);
    }
Computes the following elementCompleteness features:
<ul>
    <li><code>completeness</code>
    <li><code>fieldCompleteness</code>
    <li><code>queryCompleteness</code>
    <li><code>elementWeight</code>
</ul>

@param queryTerms the query terms with associated weights to compute over
@param field a set of weighted field values, where each is taken to be a space-separated string of tokens
@return a features object containing the values listed above
searchlib/src/main/java/com/yahoo/searchlib/ranking/features/ElementCompleteness.java