Introducing facet.method=sparse (or sfc or sparsefc) and extracting as much sparse code as possible out in dedicated sparse classes would make the code a lot cleaner. This has the added benefit of making it easier for a committer to review the patch and could make sparse an experimental feature until proven sound in production.
Some separation has been done and when the code base is switched to Solr 5.x, there will be a lot of free clean up due to the new DocValues-oriented API.
Introducing
facet.method=sparse
(orsfc
orsparsefc
) and extracting as much sparse code as possible out in dedicated sparse classes would make the code a lot cleaner. This has the added benefit of making it easier for a committer to review the patch and could make sparse an experimental feature until proven sound in production.