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


##########
solr/core/src/java/org/apache/solr/update/DocumentBuilder.java:
##########
@@ -161,14 +162,21 @@ public static Document toDocument(
           && !sfield.multiValued()
           && field.getValueCount() > 1
           && !(sfield.getType() instanceof DenseVectorField)) {
+
+        // Ensure we do not flood the logs with extremely long values
+        String fieldValue = field.getValue().toString();
+        if (fieldValue.length() > MAX_VALUES_AS_STRING_LENGTH) {
+          fieldValue = fieldValue.substring(0, MAX_VALUES_AS_STRING_LENGTH - 
4) + "...]";

Review Comment:
   Okay; that fieldValue is guaranteed to already end in that bracket is not 
obvious. Adding a simple `assert fieldValue.endsWith(']');` before truncating 
would be simple enough to clarify.  



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