Support more pages but in an ugly way

This commit is contained in:
Kerollmops 2023-06-14 15:45:00 +02:00 committed by Clément Renault
parent 23eaaf1001
commit 3c31e1cdd1
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -457,19 +457,18 @@ pub fn execute_search(
let neighbors = hnsw.nearest(&vector, ef, &mut searcher, &mut dest[..]); let neighbors = hnsw.nearest(&vector, ef, &mut searcher, &mut dest[..]);
let mut docids = Vec::new(); let mut docids = Vec::new();
for Neighbor { index, distance } in neighbors.iter() { for Neighbor { index, distance: _ } in neighbors.iter() {
let index = BEU32::new(*index as u32); let index = BEU32::new(*index as u32);
let docid = ctx.index.vector_id_docid.get(ctx.txn, &index)?.unwrap().get(); let docid = ctx.index.vector_id_docid.get(ctx.txn, &index)?.unwrap().get();
dbg!(distance, f32::from_bits(*distance));
if universe.contains(docid) { if universe.contains(docid) {
docids.push(docid); docids.push(docid);
if docids.len() == length { if docids.len() == (from + length) {
break; break;
} }
} }
} }
docids docids.into_iter().skip(from).take(length).collect()
} }
// return the search docids if the vector field is not specified // return the search docids if the vector field is not specified
None => docids, None => docids,