I checked that and indeed there is inconsistency here. StandardFacetsAccumulator and FacetsAccumulator return an empty result with the root node labeled, while the sampling accumulators return the root node not labeled. There isn't anything technically wrong here, because the category does not exist, but I think we should be consistent.
I was able to reproduce this behavior with an even simpler test Rob: index a single document with category "A" and ask to count category "B". The problem is as follows:
- SamplingAccumulator delegates to SFA.
- SFA detects this category does not exist and creates an empty FacetResult, which sets the label of the root node to the request's CategoryPath.
- SamplingAccumulator receives the results, and potentially runs SampleFixer. Then it labels the result, which then sets the label to null, after not finding it in the taxonomy.
Perhaps at some point of the code lifecycle this additional labeling was needed, I'm not sure . But I think we should either remove the call to label the results in SamplingAccumulator, or at least not call taxoReader.getPath if the node.label is not null. For instance, if you ask to count "A" (which does exist), then labeling happens twice, once by SFA.accumulate and second time by SamplingAccumulator, which is just a waste.
I'll attach later a short test which reproduces this and checks all existing accumulators.