Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Woz committed Jun 3, 2024
1 parent ea59db7 commit 609d3bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,13 @@ public function testVectorSearchEmptyStringThrowsInvalidArgument()

public function testVectorSearchEncodingWithBase64()
{
$base64EncodedVector = base64_encode('[0.32, -0.536, 0.842]');
$base64EncodedVector = "aOeYBEXJ4kI=";
$vectorQueryOne = VectorQuery::build("foo", $base64EncodedVector)->boost(0.5)->numCandidates(4);
$vectorQueryTwo = VectorQuery::build("bar", [-0.00810353, 0.6433, 0.52364]);
$searchRequest = SearchRequest::export(SearchRequest::build(VectorSearch::build([$vectorQueryOne, $vectorQueryTwo])));
$encodedVectorQuery = json_encode($searchRequest['vectorSearch']);
$this->assertEquals(JSON_ERROR_NONE, json_last_error());
$this->assertEquals("[{\"field\":\"foo\",\"boost\":0.5,\"vector_base64\":\"{$base64EncodedVector}\",\"k\":4},{\"field\":\"bar\",\"vector\":[-0.00810353,0.6433,0.52364],\"k\":3}]", $encodedVectorQuery);
$this->assertEquals(sprintf('[{"field":"foo","boost":0.5,"vector_base64":"%s","k":4},{"field":"bar","vector":[-0.00810353,0.6433,0.52364],"k":3}]', $base64EncodedVector), $encodedVectorQuery);
}

public function testScopeSearch()
Expand Down

0 comments on commit 609d3bf

Please sign in to comment.