You should reset solr.test.sys.* system properties during teardown.
Do we really need 3 shards in the test? I think we can do with just 2 and save time for the test run.
Only testSimpleQuery uses 3 shards in which one is empty. The idea of having an extra shard is that shard will not contain terms and expose bugs like
SOLR-7818. We could do with 2 shards with if we indexed something like "football world" instead of "football" in one of the documents. But then we'll have no way to compare scores of the two returned docuemnts and we can't do an equality check on the score. Maybe we could once SOLR-7759 is fixed thereby checking debug output and not comparing scores.
There's also a bunch of formatting changes that's a part of the patch. I just glanced through it, but in case it's something that's not required, it'd be good to not refactor those.
Some of this got formatted with the code style that was added for Intellij which got fixed in
In ExactStatsCache#mergeToGlobalStats we insert the terms n times ( n number of shards ). Now when a shard doesn't have a term List<Object> terms = nl.getAll(TERMS_KEY) will return empty and not null since NamedList#getAll works like that. Thus depending on the order in which the shards get hit, if the last shard had no terms the terms key was overwritten with blank causing distributed idf to not get calculated correctly.
Let's fix this as part of