Users wanting to facet count string-based fields using a non-taxonomy-based approach can use SortedSetDocValueFacetCounts, which accumulates facet counts based on a SortedSetDocValues field. This requires the stored doc values to be multi-valued (i.e., SORTED_SET), and doesn't work on single-valued fields (i.e., SORTED). In contrast, if a user wants to facet count on a stored numeric field, they can use LongValueFacetCounts, which supports both single- and multi-valued fields (and in
LUCENE-9948, we now auto-detect instead of asking the user to specify).
Let's update SortedSetDocValueFacetCounts to also support, and automatically detect single- and multi-value fields. Note that this is a spin-off issue from
LUCENE-9946, where Robert Muir points out that this can essentially be a one-line change, but we may want to do some class renaming at the same time. Also note that we should do this in ConcurrentSortedSetDocValuesFacetCounts while we're at it.