Fix query per vector to not generate an empty retrieve request (#5910)

This commit is contained in:
Arnaud Gourlay
2025-01-30 11:28:52 +01:00
committed by GitHub
parent 5a321d6f09
commit 5ea9fab003
2 changed files with 7 additions and 0 deletions

View File

@@ -416,6 +416,9 @@ impl Collection {
timeout: Option<Duration>,
hw_measurement_acc: HwMeasurementAcc,
) -> CollectionResult<Vec<RecordInternal>> {
if request.ids.is_empty() {
return Ok(Vec::new());
}
let with_payload_interface = request
.with_payload
.as_ref()

View File

@@ -224,6 +224,10 @@ impl<'coll_name> ReferencedPoints<'coll_name> {
let mut collections_names = Vec::new();
let mut vector_retrieves = Vec::new();
for (collection_name, reference_vectors_ids) in self.ids_per_collection {
// do not fetch vectors if there are no reference vectors
if reference_vectors_ids.is_empty() {
continue;
}
collections_names.push(collection_name);
let points: Vec<_> = reference_vectors_ids.into_iter().collect();
let vector_names: Vec<_> = self