ispringer commented on code in PR #5290:
URL: https://github.com/apache/solr/pull/5290#discussion_r4727775142
##########
solr/core/src/java/org/apache/solr/response/transform/ValueSourceAugmenter.java:
##########
@@ -52,8 +55,25 @@ public ValueSourceAugmenter(String name, QParser qparser,
ValueSource valueSourc
this.name = name;
this.qparser = qparser;
this.valueSource = valueSource;
- String maxPrefetchSizeRaw = qparser.getParam("preFetchDocs");
- this.maxPrefetchSize = maxPrefetchSizeRaw != null ?
Integer.parseInt(maxPrefetchSizeRaw) : 1000;
+ this.maxPrefetchSize = parseMaxPrefetchSize(qparser);
+ }
+
+ private static int parseMaxPrefetchSize(QParser qparser) {
+ String raw = qparser != null ? qparser.getParam(PREFETCH_DOCS_PARAM) :
null;
+ if (raw == null) {
+ return DEFAULT_MAX_PREFETCH_SIZE;
+ }
+ try {
+ int value = Integer.parseInt(raw);
+ if (value >= 0) {
+ return value;
+ }
+ } catch (NumberFormatException e) {
+ // fall through
+ }
+ throw new SolrException(
+ SolrException.ErrorCode.BAD_REQUEST,
+ PREFETCH_DOCS_PARAM + " must be a non-negative integer: " + raw);
}
Review Comment:
done
--
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]