From b945ee2e63e291e44d4d71f34f93dce37fd65c75 Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Tue, 3 Dec 2024 15:31:24 -0500 Subject: [PATCH 1/2] Fix CI failure in SparseVectorQueryBuilderTests --- .../xpack/core/ml/search/SparseVectorQueryBuilderTests.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilderTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilderTests.java index 9872d95de024a..a5c1ba45d90b7 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilderTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilderTests.java @@ -232,6 +232,12 @@ public void testToQuery() throws IOException { private void testDoToQuery(SparseVectorQueryBuilder queryBuilder, SearchExecutionContext context) throws IOException { Query query = queryBuilder.doToQuery(context); + + // test query builder can randomly have no vectors, which rewrites to a MatchNoneQuery - nothing more to do in this case. + if (query instanceof MatchNoDocsQuery) { + return; + } + assertTrue(query instanceof SparseVectorQueryWrapper); var sparseQuery = (SparseVectorQueryWrapper) query; if (queryBuilder.shouldPruneTokens()) { From abb0a089f96d93d8f6c9e4f9fffabef7aac9021b Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Tue, 3 Dec 2024 15:37:57 -0500 Subject: [PATCH 2/2] Unmute test --- muted-tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index 7e5e7f15700f3..9fef9f4695dba 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -232,9 +232,6 @@ tests: issue: https://github.com/elastic/elasticsearch/issues/111319 - class: org.elasticsearch.validation.DotPrefixClientYamlTestSuiteIT issue: https://github.com/elastic/elasticsearch/issues/117893 -- class: org.elasticsearch.xpack.core.ml.search.SparseVectorQueryBuilderTests - method: testToQuery - issue: https://github.com/elastic/elasticsearch/issues/117904 # Examples: #