class TermFrequencyAggregator extends IdentityAggregator {

    @Override
    public Key apply(SortedKeyValueIterator<Key,Value> itr, Document doc, AttributeFactory attrs) throws IOException {
        Key key = super.apply(itr, doc, attrs);
        
        // only return a key if something was added to the document, documents that only contain Document.DOCKEY_FIELD_NAME as they found nothing of value to
        // aggregate
        if (doc.size() == 1 && doc.get(Document.DOCKEY_FIELD_NAME) != null) {
            key = null;
            
            // empty the document
            doc.remove(Document.DOCKEY_FIELD_NAME);
        }
        
        return key;
    }

    public  TermFrequencyAggregator(Set<String> fieldsToKeep, EventDataQueryFilter attrFilter, int maxNextCount);
    public  TermFrequencyAggregator(Set<String> fieldsToKeep, EventDataQueryFilter attrFilter);

}