In SolrIndexSearcher class, the key used to lookup results in queryResultCache uses the original query.
However later in createNormalizedWeight the query gets re-written, and then saved in the queryResultCache after it's re-written.
This causes cache misses for the same query, and un-necessary inserts in the queryResultCache.
I can reproduce this using a re-ranking query that is using a main query as a dismax query, the dismax Query could be re-written into a TermQuery, which makes sense, but will cause cache misses.
I tested a quick solution by just using q.clone() when it comes to build QueryResultKey, and it works fine, but not sure if that is the best way of doing it.