dsmiley commented on code in PR #4546:
URL: https://github.com/apache/solr/pull/4546#discussion_r3471414237


##########
solr/core/src/java/org/apache/solr/handler/component/CombinedQueryComponent.java:
##########
@@ -160,6 +167,34 @@ public void prepare(ResponseBuilder rb) throws IOException 
{
     super.prepare(rb);
   }
 
+  /**
+   * Resolves {@link CombinerParams#COMBINER_QUERY_DEPTH} for this request. 
Returns {@code -1} when
+   * unset (legacy behavior: shards return {@code start + rows} per subquery, 
so the candidate pool

Review Comment:
   Why speak of "legacy behavior" for unreleased features?  Solr has not 
shipped RRF yet.  That's a sad fact but it gives us freedom to change it.



##########
solr/core/src/java/org/apache/solr/handler/component/CombinedQueryComponent.java:
##########
@@ -160,6 +167,34 @@ public void prepare(ResponseBuilder rb) throws IOException 
{
     super.prepare(rb);
   }
 
+  /**
+   * Resolves {@link CombinerParams#COMBINER_QUERY_DEPTH} for this request. 
Returns {@code -1} when
+   * unset (legacy behavior: shards return {@code start + rows} per subquery, 
so the candidate pool
+   * shifts with the page). When set, validates the value is positive and 
within the configured
+   * {@code maxQueryDepth}.
+   */
+  private int resolveQueryDepth(SolrParams params) {
+    Integer depthParam = params.getInt(CombinerParams.COMBINER_QUERY_DEPTH);
+    if (depthParam == null) {
+      return -1;
+    }
+    if (depthParam <= 0) {
+      throw new SolrException(
+          SolrException.ErrorCode.BAD_REQUEST,
+          CombinerParams.COMBINER_QUERY_DEPTH + " must be a positive integer");
+    }
+    if (depthParam > maxQueryDepth) {
+      throw new SolrException(
+          SolrException.ErrorCode.BAD_REQUEST,
+          CombinerParams.COMBINER_QUERY_DEPTH
+              + "="
+              + depthParam
+              + " exceeds configured maxQueryDepth="
+              + maxQueryDepth);
+    }

Review Comment:
   why bother enforce a max query depth?  Solr doesn't stop a user from 
requesting a bajillion rows, after all.  And the value will come from a 
~colleague programmer... not some random internet user.



-- 
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]

Reply via email to