private void handleNewHit(Hit hit) {
        if (!hit.isAuxiliary())
            concreteHitCount++;

        if (hit.getAddNumber() < 0) {
            hit.setAddNumber(size());
        }

        if (SortDataHitSorter.isSortable(hit, currentSorting())) {
            hitsWithSortData++;
        }

        hitsSorted = false;
        Set<String> hitFilled = hit.getFilled();

        if (hitFilled != null) {
            Set<String> filled = getFilledInternal();
            if (filled == null) {
                if (hitFilled.isEmpty()) {
                    // Intentionally empty
                } else if (hitFilled.size() == 1) {
                    //TODO Avoid needing set that allows null ....
                    filled = Collections.singleton(hitFilled.iterator().next());
                } else {
                    filled = new HashSet<>(hitFilled);
                }
                setFilledInternal(filled);
            } else {
                if (filled.size() == 1) {
                    if ( ! hitFilled.contains(filled.iterator().next())) {
                        filled = null; // No intersection
                        setFilledInternal(filled);
                    }
                } else {
                    filled.retainAll(hitFilled);
                }
            }
        }

        if (hit instanceof HitGroup) {
            subgroupCount++;
        }
        if (!hit.isCached()) {
            notCachedCount++;
        }
    }
Ensures result invariants. Must be called when a hit is added to this result.
container-search/src/main/java/com/yahoo/search/result/HitGroup.java