[
https://issues.apache.org/jira/browse/SOLR-18305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pascal Chollet updated SOLR-18305:
----------------------------------
Description:
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|#L828] 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}
was:
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|[https://github.com/apache/solr/blob/main/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java]#L828]
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}
> 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|#L828] 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: [email protected]
For additional commands, e-mail: [email protected]