dsmiley commented on code in PR #3418:
URL: https://github.com/apache/solr/pull/3418#discussion_r2331961665
##########
solr/core/src/java/org/apache/solr/handler/component/CombinedQuerySearchHandler.java:
##########
@@ -81,4 +88,33 @@ protected void postPrepareComponents(ResponseBuilder rb) {
crb.propagate();
}
}
+
+ /**
+ * rb.distrib {@link ResponseBuilder} must be set for the combined query to
work in case of single
+ * core standalone mode. This method set the parameter explicitly with other
required solr param
+ * i.e. shards
+ *
+ * @param req the SolrQueryRequest
+ * @return boolean denoting whether the request can be marked as distributed.
+ */
+ @Override
+ protected boolean isDistrib(SolrQueryRequest req) {
+ boolean isDistrib = super.isDistrib(req);
+ if (!isDistrib
+ && !req.getParams().getBool(ShardParams.IS_SHARD, false)
+ && req.getHttpSolrCall() != null) {
+ log.info("Configuring distributed mode to enable Combined Query.");
Review Comment:
not worth logging; or maybe trace
##########
solr/core/src/java/org/apache/solr/handler/component/CombinedQuerySearchHandler.java:
##########
@@ -81,4 +88,33 @@ protected void postPrepareComponents(ResponseBuilder rb) {
crb.propagate();
}
}
+
+ /**
+ * rb.distrib {@link ResponseBuilder} must be set for the combined query to
work in case of single
+ * core standalone mode. This method set the parameter explicitly with other
required solr param
+ * i.e. shards
+ *
+ * @param req the SolrQueryRequest
+ * @return boolean denoting whether the request can be marked as distributed.
+ */
+ @Override
+ protected boolean isDistrib(SolrQueryRequest req) {
+ boolean isDistrib = super.isDistrib(req);
+ if (!isDistrib
+ && !req.getParams().getBool(ShardParams.IS_SHARD, false)
+ && req.getHttpSolrCall() != null) {
+ log.info("Configuring distributed mode to enable Combined Query.");
+ ModifiableSolrParams solrParams = new
ModifiableSolrParams(req.getParams());
+ String scheme = req.getHttpSolrCall().getReq().getScheme();
+ String host = req.getHttpSolrCall().getReq().getServerName();
+ int port = req.getHttpSolrCall().getReq().getServerPort();
+ String context = req.getHttpSolrCall().getReq().getContextPath();
+ String core = req.getCore().getName();
+ String localShardUrl = String.format("%s://%s:%d%s/%s", scheme, host,
port, context, core);
+ solrParams.set(ShardParams.SHARDS, localShardUrl);
+ req.setParams(solrParams);
Review Comment:
I think it's a bit sneaky that a predicate looking method has a side-effect.
This is a hack to work around a need for something proper -- for a component
or handler to communicate we need the distributed search algorithm (no
so-called short-circuit).
##########
solr/core/src/test/org/apache/solr/handler/component/DistributedCombinedQueryComponentTest.java:
##########
Review Comment:
Please update this test to not call `queryServer` since it doesn't compare
against the control client. I wish that method came with a big fat disclaimer
and was named differently that didn't look so normal. There are probably more
callers of it than there should be. I did
https://github.com/apache/solr/pull/3639 just now.
In order for this test to compare both single shard & multi-shard with score
relevancy, you could do a couple different things. One is to use the
ExactStatsCache for distributed-IDF. *Or*, write queries that set a
constant/fixed score. That would actually be most clear.
With such a test, you don't need to test non-distributed since the test
infrastructure here allows you to do both as one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]