qdrant-edge 0.8.0

A lightweight, in-process vector search engine designed for embedded devices, autonomous systems, and mobile agents.
Documentation
use crate::common::types::ScoreType;

use crate::segment::common::operation_error::{OperationError, OperationResult};
use crate::segment::data_types::vectors::DenseVector;

mod context_query;
mod discover_query;
mod feedback_query;
mod reco_query;

pub use context_query::{ContextPair, ContextQuery};
pub use discover_query::DiscoverQuery;
pub use feedback_query::{FeedbackItem, NaiveFeedbackCoefficients, NaiveFeedbackQuery};
pub use reco_query::{RecoBestScoreQuery, RecoQuery, RecoSumScoresQuery};

pub trait TransformInto<Output, T = DenseVector, U = DenseVector> {
    /// Change the underlying type of the query, or just process it in some way.
    fn transform(self, f: &dyn Fn(T) -> OperationResult<U>) -> OperationResult<Output>;

    fn transform_into(self) -> OperationResult<Output>
    where
        Self: Sized,
        T: TryInto<U, Error = OperationError>,
    {
        self.transform(&|v| v.try_into())
    }
}

pub trait Query<T> {
    /// Compares the vectors of the query against a single vector via a similarity function,
    /// then folds the similarites into a single score.
    fn score_by(&self, similarity: impl Fn(&T) -> ScoreType) -> ScoreType;
}