You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Pierre Salagnac (Jira)" <ji...@apache.org> on 2026/07/08 13:41:00 UTC

[jira] [Comment Edited] (SOLR-18305) Time-limited requests are scored with the default BM25Similarity instead of the schema similarity

    [ https://issues.apache.org/jira/browse/SOLR-18305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18094580#comment-18094580 ] 

Pierre Salagnac edited comment on SOLR-18305 at 7/8/26 1:40 PM:
----------------------------------------------------------------

By reading the description of this issue, it seems to me it's very related to what I tried to explain in [this comment|https://issues.apache.org/jira/browse/SOLR-18156?focusedCommentId=18066804&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-18066804].


was (Author: JIRAUSER308021):
By reading the description of this issue, it seems to me it's very related to what I tried to explain in this comment.

> Time-limited requests are scored with the default BM25Similarity instead of the schema similarity
> -------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-18305
>                 URL: https://issues.apache.org/jira/browse/SOLR-18305
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 10.0
>            Reporter: Pascal Chollet
>            Priority: Major
>
> In 10.0.0, SolrIndexSearcher.search(Query, Collector) handles any request with query limits enabled (e.g. timeAllowed) by delegating to a fresh anonymous new IndexSearcher(reader, executor) to reuse Lucene's timeout support (SolrIndexSearcher.java ~line 805). All weights for the request are created through this inner searcher, but it never inherits the outer searcher's configuration. Consequences:
>  # Weights are built with IndexSearcher's default BM25Similarity instead of the schema similarity (SolrIndexSearcher's constructor calls setSimilarity(schema.getSimilarity()); the inner searcher doesn't). Every time-limited request is therefore ranked with BM25 regardless of the configured similarity, while debug.explain and TopFieldCollector#populateScores (which run on the real searcher) report the correct scores. Results: inflated scores and maxScore under pure relevance sort, non-monotonic "score" values under compound sorts, and inconsistent queryResultCache content because warming queries (no limits) produce differently-ranked entries than user queries with timeAllowed.
>  # The inner searcher runs with Lucene's default query cache, although SolrIndexSearcher explicitly disables it (setQueryCache(null)) in favor of Solr's own caching.
> Reproduce: schema with any non-default similarity (per-field or global), compare fl=score with debug.explain on the same query with and without timeAllowed — with timeAllowed they diverge.
> On main branch this code was restructured (the anonymous searcher only wraps searchLeaf with a weight pre-built by the real searcher), which incidentally fixes both points, but 10.0.0 ships the broken variant. A minimal fix for a 10.x bugfix release is to propagate the configuration in the anonymous class:
> {quote}setSimilarity(SolrIndexSearcher.this.getSimilarity());
> setQueryCache(SolrIndexSearcher.this.getQueryCache());
> {quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org