Skip to content

Commit

Permalink
Fixed vector-search test failures due to Untrained-index warning
Browse files Browse the repository at this point in the history
With the latest vectorsearch extension, there were a couple of test
failures caused by unexpected "Untrained index..." warnings.
  • Loading branch information
snej committed Jun 24, 2024
1 parent def4ffb commit 81d7e06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions LiteCore/tests/LazyVectorQueryTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ TEST_CASE_METHOD(LazyVectorQueryTest, "Lazy Vector Index", "[Query][.VectorSearc
Retained<QueryEnumerator> 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);
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions LiteCore/tests/VectorQueryTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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]") {
Expand Down

0 comments on commit 81d7e06

Please sign in to comment.