From 791c6ca98dd086bfa6b189a13962a34d71d9f5ad Mon Sep 17 00:00:00 2001 From: zhichao-aws Date: Mon, 25 Sep 2023 19:49:33 +0800 Subject: [PATCH] use StringUtils to check Signed-off-by: zhichao-aws --- .../neuralsearch/query/SparseEncodingQueryBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/opensearch/neuralsearch/query/SparseEncodingQueryBuilder.java b/src/main/java/org/opensearch/neuralsearch/query/SparseEncodingQueryBuilder.java index adb4315b5..f75a56b50 100644 --- a/src/main/java/org/opensearch/neuralsearch/query/SparseEncodingQueryBuilder.java +++ b/src/main/java/org/opensearch/neuralsearch/query/SparseEncodingQueryBuilder.java @@ -18,6 +18,7 @@ import lombok.experimental.Accessors; import lombok.extern.log4j.Log4j2; +import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.lucene.document.FeatureField; @@ -251,7 +252,7 @@ protected Query doToQuery(QueryShardContext context) throws IOException { } private static void validateForRewrite(String queryText, String modelId) { - if (null == queryText || null == modelId) { + if (StringUtils.isBlank(queryText) || StringUtils.isBlank(modelId)) { throw new IllegalArgumentException( "When " + QUERY_TOKENS_FIELD.getPreferredName()