fix the tests and the arroy_readers method

This commit is contained in:
Tamo 2024-09-19 10:32:17 +02:00
parent cc45e264ca
commit 79f29eed3c
13 changed files with 39 additions and 40 deletions

View file

@ -5522,6 +5522,7 @@ mod tests {
400,
),
},
quantized: None,
},
user_provided: RoaringBitmap<[1, 2]>,
},
@ -5534,28 +5535,8 @@ mod tests {
// the document with the id 3 should keep its original embedding
let docid = index.external_documents_ids.get(&rtxn, "3").unwrap().unwrap();
let mut embeddings = Vec::new();
'vectors: for i in 0..=u8::MAX {
let reader = arroy::Reader::open(&rtxn, i as u16, index.vector_arroy)
.map(Some)
.or_else(|e| match e {
arroy::Error::MissingMetadata(_) => Ok(None),
e => Err(e),
})
.transpose();
let Some(reader) = reader else {
break 'vectors;
};
let embedding = reader.unwrap().item_vector(&rtxn, docid).unwrap();
if let Some(embedding) = embedding {
embeddings.push(embedding)
} else {
break 'vectors;
}
}
let embeddings = index.embeddings(&rtxn, docid).unwrap();
let embeddings = &embeddings["my_doggo_embedder"];
snapshot!(embeddings.len(), @"1");
assert!(embeddings[0].iter().all(|i| *i == 3.0), "{:?}", embeddings[0]);
@ -5740,6 +5721,7 @@ mod tests {
400,
),
},
quantized: None,
},
user_provided: RoaringBitmap<[0]>,
},
@ -5783,6 +5765,7 @@ mod tests {
400,
),
},
quantized: None,
},
user_provided: RoaringBitmap<[]>,
},