Skip to main content

QdrantDriver

Struct QdrantDriver 

Source
pub struct QdrantDriver { /* private fields */ }
Expand description

High-performance gRPC driver for Qdrant.

Uses gRPC/HTTP2 with zero-copy protobuf encoding:

  • Encodes protobuf directly with pre-computed headers
  • Reuses buffers to minimize allocations
  • Uses memcpy for vector data (no per-element loop)

§Example

use qail_qdrant::QdrantDriver;
use qail_core::prelude::*;

let driver = QdrantDriver::connect("localhost", 6334).await?;

let results = driver.search(
    "products",
    &embedding,
    10,
    Some(0.5),
).await?;

Implementations§

Source§

impl QdrantDriver

Source

pub async fn connect(host: &str, port: u16) -> QdrantResult<Self>

Connect to Qdrant gRPC endpoint (default port 6334).

Source

pub async fn connect_addr(addr: &str) -> QdrantResult<Self>

Connect with address string.

Source

pub async fn connect_tls(host: &str, port: u16) -> QdrantResult<Self>

Connect to Qdrant gRPC endpoint with TLS (rustls).

Uses Mozilla root certificates — no system openssl required.

Source

pub async fn connect_url(url: &str) -> QdrantResult<Self>

Connect with URL auto-detection (https = TLS, http = plain).

Source

pub async fn search( &mut self, collection: &str, vector: &[f32], limit: u64, score_threshold: Option<f32>, ) -> QdrantResult<Vec<ScoredPoint>>

Vector similarity search with zero-copy encoding.

§Performance

Vector is encoded via memcpy (no per-element serialization).

Source

pub async fn search_named( &mut self, collection: &str, vector_name: &str, vector: &[f32], limit: u64, score_threshold: Option<f32>, ) -> QdrantResult<Vec<ScoredPoint>>

Vector search with named vector field.

Source

pub async fn search_with_request( &mut self, request: SearchRequest<'_>, ) -> QdrantResult<Vec<ScoredPoint>>

Vector similarity search using the shared search request options.

Source

pub async fn search_filtered( &mut self, collection: &str, vector: &[f32], limit: u64, score_threshold: Option<f32>, conditions: &[Condition], is_or: bool, ) -> QdrantResult<Vec<ScoredPoint>>

Filtered vector search using QAIL AST conditions.

Translates QAIL conditions into Qdrant’s protobuf filter (must/should) and includes them in the gRPC search request.

Source

pub async fn search_filtered_grouped( &mut self, request: SearchRequest<'_>, must_conditions: &[Condition], should_conditions: &[Condition], ) -> QdrantResult<Vec<ScoredPoint>>

Filtered vector search with grouped conditions.

must_conditions are joined with AND, should_conditions with OR.

Source

pub async fn search_filtered_grouped_cages( &mut self, request: SearchRequest<'_>, must_conditions: &[Condition], should_groups: &[Vec<Condition>], ) -> QdrantResult<Vec<ScoredPoint>>

Filtered vector search preserving OR-cage groups.

Each OR group is treated as its own disjunction that must be satisfied.

Source

pub async fn search_batch( &mut self, collection: &str, vectors: &[Vec<f32>], limit: u64, score_threshold: Option<f32>, ) -> QdrantResult<Vec<Vec<ScoredPoint>>>

Search multiple vectors concurrently using HTTP/2 pipelining.

This sends all requests concurrently over a single h2 connection, achieving 2-3x speedup compared to sequential searches.

§Example
let vectors = vec![vec1, vec2, vec3];
let results = driver.search_batch("products", &vectors, 10, None).await?;
Source

pub async fn search_ast(&mut self, cmd: &Qail) -> QdrantResult<Vec<ScoredPoint>>

Search using QAIL AST.

Extracts vector, collection, limit from the Qail command. If conditions are present in the AST, they are included as filters.

Source

pub async fn upsert( &mut self, collection: &str, points: &[Point], wait: bool, ) -> QdrantResult<()>

Upsert points with zero-copy encoding.

Source

pub async fn get_points( &mut self, collection: &str, ids: &[PointId], with_vectors: bool, ) -> QdrantResult<Vec<ScoredPoint>>

Get points by ID (with payload and optional vectors).

Source

pub async fn scroll( &mut self, collection: &str, limit: u32, offset: Option<&PointId>, with_vectors: bool, ) -> QdrantResult<ScrollResult>

Scroll through points (paginated iteration).

Source

pub async fn scroll_filtered_grouped_cages( &mut self, collection: &str, limit: u32, offset: Option<&PointId>, with_vectors: bool, must_conditions: &[Condition], should_groups: &[Vec<Condition>], ) -> QdrantResult<ScrollResult>

Scroll through points with QAIL AST filters.

Source

pub async fn delete_points( &mut self, collection_name: &str, point_ids: &[u64], ) -> QdrantResult<()>

Delete points by numeric IDs.

Source

pub async fn delete_points_by_id( &mut self, collection_name: &str, ids: &[PointId], ) -> QdrantResult<()>

Delete points by PointId (supports both numeric and UUID).

Source

pub async fn update_payload( &mut self, collection: &str, point_ids: &[PointId], payload: &Payload, wait: bool, ) -> QdrantResult<()>

Update payload on existing points.

Source

pub async fn create_collection( &mut self, collection_name: &str, vector_size: u64, distance: Distance, on_disk: bool, ) -> QdrantResult<()>

Create a collection with specific vector parameters.

Source

pub async fn delete_collection( &mut self, collection_name: &str, ) -> QdrantResult<()>

Delete a collection.

Source

pub async fn create_field_index( &mut self, collection: &str, field_name: &str, field_type: FieldType, wait: bool, ) -> QdrantResult<()>

Create a payload field index for faster filtering.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ColumnValue<Value> for T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more