Hi, Adrien. Thanks for forwarding this. Daniele, you pointed to the code which bypasses Lucene searching and just sorts cached docset. Applying filter before searching is done by getProcessedFilter() https://github.com/apache/solr/blob/c2db3a943e665cfb39e9ea53640be40cf2c09fbc/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java#L956
Happy New Year! On Mon, Jan 3, 2022 at 5:12 PM Adrien Grand <[email protected]> wrote: > Hi Daniele, > > This is the Lucene dev list, I'm redirecting your question to > [email protected]. > > On Fri, Dec 31, 2021 at 5:35 PM Daniele Antuzi <[email protected]> > wrote: > > > > Hi, > > I was taking a look at the Solr searcher to see how the filterCache is > used: > https://github.com/apache/solr/blob/c2db3a943e665cfb39e9ea53640be40cf2c09fbc/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java#L1379-L1398 > > Reading the code, it turned out that the filterCache is not used if the > sort contains the score or if we don't have any score specified (by > default, it sorts by score). > > As far as I know, the filterCache contains an unordered set of documents > so the sort must be calculated after the application of the filter query. > > Then, also the score should be computed after the filter query to have a > smaller set of documents. > > That being said, I don't understand why Solr does not use the > filterCache if the score is somehow involved in the sort. > > In theory, it can > > > > apply the filter query reducing the number of result > > computes the score > > sort the results > > > > Am I missing something? > > > > Happy new year, > > Daniele > > > > > -- > Adrien > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Sincerely yours Mikhail Khludnev
