gus-asf commented on code in PR #2666:
URL: https://github.com/apache/solr/pull/2666#discussion_r1773633493


##########
solr/CHANGES.txt:
##########
@@ -109,8 +109,11 @@ New Features
 
 Improvements
 ---------------------
+* SOLR-17158: Users for whom partial results are uninteresting may set 
partialResultsAllowed=false. This allows Solr to reduce time spent processing 
partial results and omit them from the response. (Gus Heck, Andrzej Bialeki, 
hossman)

Review Comment:
   done, chose the ascii form. Though I see some non-ascii names, I used ascii 
for consistency with all your other contribs.



##########
solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java:
##########
@@ -80,6 +94,39 @@ public HttpShardHandler(HttpShardHandlerFactory 
httpShardHandlerFactory) {
     shardToURLs = new HashMap<>();
   }
 
+  /**
+   * Parse the {@value ShardParams#SHARDS_TOLERANT} param from 
<code>params</code> as a boolean;
+   * accepts {@value ShardParams#REQUIRE_ZK_CONNECTED} as a valid value 
indicating <code>false
+   * </code>.
+   *
+   * <p>By default, returns <code>false</code> when {@value 
ShardParams#SHARDS_TOLERANT} is not set
+   * in <code>
+   * params</code>.
+   */
+  public static boolean getShardsTolerantAsBool(SolrQueryRequest req) {
+    String shardsTolerantValue = 
req.getParams().get(ShardParams.SHARDS_TOLERANT);
+    if (null == shardsTolerantValue
+        || 
shardsTolerantValue.trim().equals(ShardParams.REQUIRE_ZK_CONNECTED)) {
+      return false;
+    } else {
+      boolean tolerant = StrUtils.parseBool(shardsTolerantValue.trim());
+      if (tolerant && shouldDiscardPartials(req.getParams())) {

Review Comment:
   done



##########
solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java:
##########
@@ -66,6 +67,22 @@ public static SolrRequestInfo getRequestInfo() {
     return stack.peek();
   }
 
+  public static Optional<SolrRequestInfo> getReqInfo() {
+    return Optional.ofNullable(getRequestInfo());
+  }
+
+  public static Optional<SolrQueryRequest> getRequest() {
+    return getReqInfo().map(i -> i.req);
+  }
+
+  public static boolean shouldDiscardPartials() {

Review Comment:
   removed and inlined.



-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to