- test case where all vectors were generated

- update tests following changes in behavior from previous commit
This commit is contained in:
Louis Dureuil 2024-06-13 17:16:41 +02:00
parent b9b938c902
commit 09d9b63e1c
No known key found for this signature in database
2 changed files with 124 additions and 40 deletions

View file

@ -73,7 +73,48 @@ async fn reset_embedder_documents() {
server.wait_task(response.uid()).await;
// Make sure the documents are still present
let (documents, _code) = index.get_all_documents(Default::default()).await;
let (documents, _code) = index
.get_all_documents(GetAllDocumentsOptions {
limit: None,
offset: None,
retrieve_vectors: false,
fields: None,
})
.await;
snapshot!(json_string!(documents), @r###"
{
"results": [
{
"id": 0,
"name": "kefir"
},
{
"id": 1,
"name": "echo"
},
{
"id": 2,
"name": "billou"
},
{
"id": 3,
"name": "intel"
},
{
"id": 4,
"name": "max"
}
],
"offset": 0,
"limit": 20,
"total": 5
}
"###);
// Make sure we are still able to retrieve their vectors
let (documents, _code) = index
.get_all_documents(GetAllDocumentsOptions { retrieve_vectors: true, ..Default::default() })
.await;
snapshot!(json_string!(documents), @r###"
{
"results": [
@ -174,45 +215,6 @@ async fn reset_embedder_documents() {
}
"###);
// Make sure we are still able to retrieve their vectors
let (documents, _code) = index
.get_all_documents(GetAllDocumentsOptions { retrieve_vectors: true, ..Default::default() })
.await;
snapshot!(json_string!(documents), @r###"
{
"results": [
{
"id": 0,
"name": "kefir",
"_vectors": {}
},
{
"id": 1,
"name": "echo",
"_vectors": {}
},
{
"id": 2,
"name": "billou",
"_vectors": {}
},
{
"id": 3,
"name": "intel",
"_vectors": {}
},
{
"id": 4,
"name": "max",
"_vectors": {}
}
],
"offset": 0,
"limit": 20,
"total": 5
}
"###);
// Make sure the arroy DB has been cleared
let (documents, _code) = index.search_post(json!({ "vector": [1, 1, 1] })).await;
snapshot!(json_string!(documents), @r###"