Skip to content

Commit

Permalink
Revert error messages to be BWC compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
kderusso committed Dec 17, 2024
1 parent 9c25161 commit db3c768
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,24 @@ public SparseVectorQueryBuilder(
+ QUERY_VECTOR_FIELD.getPreferredName()
+ "] or ["
+ INFERENCE_ID_FIELD.getPreferredName()
+ "]"
+ "] for "
+ ALLOWED_FIELD_TYPE
+ " fields"
);
}

// Preserve BWC error messaging
if ((queryVectors == null) == (query == null)) {
throw new IllegalArgumentException(
"[" + NAME + "] requires one of [" + QUERY_VECTOR_FIELD.getPreferredName() + "] or [" + QUERY_FIELD.getPreferredName() + "]"
);
}

if (inferenceId != null && query == null) {
throw new IllegalArgumentException(
"["
+ NAME
+ "] requires ["
+ QUERY_FIELD.getPreferredName()
+ "] when ["
+ "] requires one of ["
+ QUERY_VECTOR_FIELD.getPreferredName()
+ "] or ["
+ INFERENCE_ID_FIELD.getPreferredName()
+ "] is specified"
+ "] for "
+ ALLOWED_FIELD_TYPE
+ " fields"
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.elasticsearch.action.OriginalIndices;
import org.elasticsearch.action.ResolvedIndices;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.InferenceFieldMetadata;
import org.elasticsearch.common.settings.Settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.xpack.core.ml.search.SparseVectorQueryBuilder;
import org.elasticsearch.xpack.inference.mapper.SemanticTextField;
import org.elasticsearch.xpack.inference.queries.SemanticMatchQueryRewriteInterceptor;
import org.elasticsearch.xpack.inference.queries.SemanticQueryBuilder;
import org.elasticsearch.xpack.inference.queries.SemanticSparseVectorQueryRewriteInterceptor;
import org.junit.After;
import org.junit.Before;
Expand Down

0 comments on commit db3c768

Please sign in to comment.