From e155b424170a56b38b82b7c0104c7b3a90a653c3 Mon Sep 17 00:00:00 2001 From: yuye-aws Date: Thu, 7 Mar 2024 13:40:07 +0800 Subject: [PATCH] update max chunk limit in delimiter Signed-off-by: yuye-aws --- .../neuralsearch/processor/chunker/DelimiterChunker.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/opensearch/neuralsearch/processor/chunker/DelimiterChunker.java b/src/main/java/org/opensearch/neuralsearch/processor/chunker/DelimiterChunker.java index e35a811c8..e99849b53 100644 --- a/src/main/java/org/opensearch/neuralsearch/processor/chunker/DelimiterChunker.java +++ b/src/main/java/org/opensearch/neuralsearch/processor/chunker/DelimiterChunker.java @@ -16,6 +16,8 @@ public DelimiterChunker() {} public static String MAX_CHUNK_LIMIT_FIELD = "max_chunk_limit"; + private static final int DEFAULT_MAX_CHUNK_LIMIT = 100; + @Override public void validateParameters(Map parameters) { if (parameters.containsKey(DELIMITER_FIELD)) { @@ -30,8 +32,8 @@ public void validateParameters(Map parameters) { Object maxChunkLimit = parameters.get(MAX_CHUNK_LIMIT_FIELD); if (!(maxChunkLimit instanceof Integer)) { throw new IllegalArgumentException("Parameter max_chunk_limit:" + maxChunkLimit.toString() + " should be integer."); - } else if ((int) maxChunkLimit <= 0) { - throw new IllegalArgumentException("Parameter max_chunk_limit:" + maxChunkLimit + " is not greater than 0."); + } else if ((int) maxChunkLimit < 0) { + throw new IllegalArgumentException("Parameter max_chunk_limit:" + maxChunkLimit + " is negative."); } } }