The following code has been found to be confusing to multiple folks working in SimpleFacets.java (see SOLR-10132)
This is found around line 482 or so. The comment in the code above is mine, and won't be found in the codebase. This ticket can be resolved by eliminating the complex check and just denying all termFilters with a better exception message not specific to contains filters (and perhaps consolidated with the proceeding check for about prefix filters?), or adding a comment to the code base explaining why we need to allow a term filter with an empty, non-null string to be processed, and why this isn't an NPE waiting to happen.