My google-fu got better -- FWIW This looks like an issue fixed in the normal rerank query code, but not in LTR, which is a different query parser / query path?
https://issues.apache.org/jira/browse/SOLR-7689 On Tue, Oct 17, 2023 at 4:03 PM Doug Turnbull <douglas.turnb...@reddit.com> wrote: > Hi all, > > I'm noticing an issue where rerank queries never appear to enter the Solr > queryResultCache > > You can notice this, as a user, by simply repeating requests to a node. > You'll get an instantaneous response repeating most Solr queries. However, > repeating anything with rq= added, each response takes about the same > amount of time. > > I dug into this some in a debugger, and created a test (in LTR) to > recreate this > > > https://github.com/apache/solr/compare/main...softwaredoug:solr:no-rerank-caching?expand=1 > > We do a lookup using a NON rewritten version of the query, here > > https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java#L1561 > > Later, prior to executing the query, Lucene's search method performs a > rewrite: > > > https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java#L514 > > This causes a rerank query (like LTR's) to rewrite its main query, saving > it internally: > > > https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/search/AbstractReRankQuery.java#L100 > > Then this is what's put into the cache > > So later on, when the same query comes in, in its non-rewritten form, its > never seen in the cache > > Am I missing something? It would appear that any query where its child > queries get rewritten would never get cached by Solr? > > Thanks > -Doug >