This should really be extracted into the appropriate service (if it exists, maybe `solrFacetService`) or at the very least to a separate function, but it's not really a good idea to have this on a controller; I understand the controller was already quite beefy, but there's no need to aggravate the situation.