Dmitry Tikhonov created SOLR-18676:
--------------------------------------

             Summary: Combined Query (RRF): fuse on a single core in standalone 
and embedded Solr
                 Key: SOLR-18676
                 URL: https://issues.apache.org/jira/browse/SOLR-18676
             Project: Solr
          Issue Type: Improvement
          Components: Embedded, search
            Reporter: Dmitry Tikhonov


Combined Query (SOLR-17319) always forces distributed search: 
CombinedQuerySearchHandler
calls setForcedDistrib(true), and the sub-query lists are fused only in
CombinedQueryComponent.mergeIds on the coordinator. Outside SolrCloud this has 
three
consequences:

* Embedded Solr (EmbeddedSolrServer) cannot run a combined query at all: with 
no shards
  parameter, HttpShardHandler.prepDistributed builds the shard URL from
  req.getHttpSolrCall(), which is null there.
* Standalone Solr sends every combined query to itself over HTTP, and needs its 
own URL
  in solr.security.allow.urls (documented as a requirement).
* With distrib=false, process() returns QueryAndResponseCombiner.simpleCombine: 
a union
  in HashMap order, with no RRF and no sort.

Proposal: outside SolrCloud, a combined query that names no shards (and does 
not ask for
distrib=true) is fused on the core that receives it. The local path is mergeIds 
over the
lists of a single shard, sharing its code (union and collapse across 
sub-queries, the
configured combiner, the request's sort, numFound and numFoundExact, combiner
explanations). A single core therefore answers exactly what a one-shard 
distributed
search over that core answers. Each sub-query is fetched to start + rows, or 
shards.rows
when given, as a shard would be. SolrCloud behaviour is unchanged: the 
coordinator still
always fuses.

While comparing the local and distributed answers, two existing bugs of the 
distributed
path came up, fixed in the same change (they can be split out):

1. A single-pass distributed combined query (e.g. fl=id,score) returns one 
sub-query's
   raw score for each document instead of its fused (RRF) score; a two-pass 
request
   returns the fused score. CombinedQueryComponent now overrides returnFields 
to set the
   fused score.
2. Elevation from elevate.xml that matches the text of only some sub-queries 
fails the
   request with IndexOutOfBoundsException (SolrCloud included). 
QueryElevationComponent
   copies the first sub-query's elevated SortSpec onto the request, but each 
sub-query's
   sort values are computed for its own sort, which then lacks the _elevate_ 
field. Sort
   values are now computed for the request's sort for every sub-query.

Behaviour change: standalone Solr no longer distributes a combined query to 
itself, so
it no longer needs its own URL allow-listed, and distrib=false returns the 
fused, sorted
result.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to