From 81d7e06ce022fd6743f99e75a2a77c0e32d0aa29 Mon Sep 17 00:00:00 2001 From: Jens Alfke Date: Mon, 24 Jun 2024 12:38:53 -0700 Subject: [PATCH] Fixed vector-search test failures due to Untrained-index warning With the latest vectorsearch extension, there were a couple of test failures caused by unexpected "Untrained index..." warnings. --- LiteCore/tests/LazyVectorQueryTest.cc | 2 ++ LiteCore/tests/VectorQueryTest.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/LiteCore/tests/LazyVectorQueryTest.cc b/LiteCore/tests/LazyVectorQueryTest.cc index a96de1326..07d285a34 100644 --- a/LiteCore/tests/LazyVectorQueryTest.cc +++ b/LiteCore/tests/LazyVectorQueryTest.cc @@ -141,6 +141,7 @@ TEST_CASE_METHOD(LazyVectorQueryTest, "Lazy Vector Index", "[Query][.VectorSearc Retained e; e = (_query->createEnumerator(&_options)); REQUIRE(e->getRowCount() == 0); // index is empty so far + ++expectedWarningsLogged; // "Untrained index; queries may be slow." REQUIRE(updateVectorIndex(200, alwaysUpdate) == 200); REQUIRE(updateVectorIndex(999, alwaysUpdate) == 200); @@ -169,6 +170,7 @@ TEST_CASE_METHOD(LazyVectorQueryTest, "Lazy Vector Index Skipping", "[Query][.Ve // rec-291, rec-171 and rec-081 are missing because unindexed checkQueryReturns({"rec-039", "rec-249", "rec-345", "rec-159", "rec-369"}); + ++expectedWarningsLogged; // "Untrained index; queries may be slow." // Update the index again; only the skipped docs will appear this time. size_t nIndexed = 0; diff --git a/LiteCore/tests/VectorQueryTest.cc b/LiteCore/tests/VectorQueryTest.cc index 4648a0ef8..91066ffe3 100644 --- a/LiteCore/tests/VectorQueryTest.cc +++ b/LiteCore/tests/VectorQueryTest.cc @@ -587,6 +587,7 @@ TEST_CASE_METHOD(SIFTVectorQueryTest, "Index isTrained API", "[Query][.VectorSea bool isTrained = collection->isIndexTrained("vecIndex"_sl); CHECK(isTrained == expectedTrained); + if ( !isTrained ) ++expectedWarningsLogged; // "Untrained index; queries may be slow." } N_WAY_TEST_CASE_METHOD(SIFTVectorQueryTest, "Inspect Vector Index", "[Query][.VectorSearch]") {