Skip to main content

qdrant_edge/edge/
retrieve.rs

1use std::sync::atomic::AtomicBool;
2
3use crate::common::counter::hardware_accumulator::HwMeasurementAcc;
4use crate::common::types::DeferredBehavior;
5use crate::segment::common::operation_error::OperationResult;
6use crate::segment::types::{ExtendedPointId, WithPayload, WithPayloadInterface, WithVector};
7use crate::shard::retrieve::record_internal::RecordInternal;
8use crate::shard::retrieve::retrieve_blocking::retrieve_blocking;
9
10use crate::edge::{DEFAULT_EDGE_TIMEOUT, EdgeShard};
11
12impl EdgeShard {
13    pub fn retrieve(
14        &self,
15        point_ids: &[ExtendedPointId],
16        with_payload: Option<WithPayloadInterface>,
17        with_vector: Option<WithVector>,
18    ) -> OperationResult<Vec<RecordInternal>> {
19        let with_payload =
20            WithPayload::from(with_payload.unwrap_or(WithPayloadInterface::Bool(true)));
21        let with_vector = with_vector.unwrap_or(WithVector::Bool(false));
22
23        let mut points = retrieve_blocking(
24            self.segments.clone(),
25            point_ids,
26            &with_payload,
27            &with_vector,
28            DEFAULT_EDGE_TIMEOUT,
29            &AtomicBool::new(false),
30            HwMeasurementAcc::disposable_edge(),
31            DeferredBehavior::Exclude,
32        )?;
33
34        let points: Vec<_> = point_ids
35            .iter()
36            .filter_map(|id| points.remove(id))
37            .collect();
38
39        Ok(points)
40    }
41}