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


##########
solr/core/src/java/org/apache/solr/search/QueryLimits.java:
##########
@@ -108,12 +110,21 @@ public String formatExceptionMessage(String label) {
    * @throws QueryLimitsExceededException if {@link 
CommonParams#PARTIAL_RESULTS} request parameter
    *     is false and limits have been reached.
    */
+  public boolean maybeExitWithPartialResults(Supplier<String> label)
+      throws QueryLimitsExceededException {
+    return maybeExitWithPartialResults(label.get());
+  }
+
   public boolean maybeExitWithPartialResults(String label) throws 
QueryLimitsExceededException {
     if (isLimitsEnabled() && shouldExit()) {
       if (allowPartialResults) {
         if (rsp != null) {
           rsp.setPartialResults();
-          rsp.addPartialResponseDetail(formatExceptionMessage(label));
+          if 
(rsp.getResponseHeader().get(RESPONSE_HEADER_PARTIAL_RESULTS_DETAILS_KEY) == 
null) {

Review Comment:
   Well typically before I did this we would get the initial limit violation, 
and then at least one component violation which isn't really interesting 
because the first one is where we really stopped. Also there are tests that 
check the contents of partialResultsDetail using `JSONTestUtil.match()` which 
doesn't seem to have a syntax for handling duplicate keys (or if it does I 
can't figure out what it is), and also if someone out there has been using a 
Jackson Object Mapper or similar to turn the header into an object (or 
JSON.parse() in javascript where they'll loose one anyway) things could go 
sideways if they suddenly encounter either a duplicate key or an array there... 
I can provide a rant about the fact we allow/use duplicate keys in the first 
place, how we should be referring to our APIs as noggit APIs not JSON APIs 
because we accept illegal JSON... etc... If you're interested :)



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