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
impl QdrantDriver
Sourcepub async fn connect(host: &str, port: u16) -> QdrantResult<Self>
pub async fn connect(host: &str, port: u16) -> QdrantResult<Self>
Connect to Qdrant gRPC endpoint (default port 6334).
Sourcepub async fn connect_addr(addr: &str) -> QdrantResult<Self>
pub async fn connect_addr(addr: &str) -> QdrantResult<Self>
Connect with address string.
Sourcepub async fn search(
&mut self,
collection: &str,
vector: &[f32],
limit: u64,
score_threshold: Option<f32>,
) -> QdrantResult<Vec<ScoredPoint>>
pub async fn search( &mut self, collection: &str, vector: &[f32], limit: u64, score_threshold: Option<f32>, ) -> QdrantResult<Vec<ScoredPoint>>
Sourcepub async fn search_batch(
&mut self,
collection: &str,
vectors: &[Vec<f32>],
limit: u64,
score_threshold: Option<f32>,
) -> QdrantResult<Vec<Vec<ScoredPoint>>>
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?;Sourcepub async fn search_ast(&mut self, cmd: &Qail) -> QdrantResult<Vec<ScoredPoint>>
pub async fn search_ast(&mut self, cmd: &Qail) -> QdrantResult<Vec<ScoredPoint>>
Search using QAIL AST.
Extracts vector, collection, limit from the Qail command.
Sourcepub async fn upsert(
&mut self,
collection: &str,
points: &[Point],
wait: bool,
) -> QdrantResult<()>
pub async fn upsert( &mut self, collection: &str, points: &[Point], wait: bool, ) -> QdrantResult<()>
Upsert points with zero-copy encoding.
Sourcepub async fn create_collection(
&mut self,
collection_name: &str,
vector_size: u64,
distance: Distance,
on_disk: bool,
) -> QdrantResult<()>
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.
Sourcepub async fn delete_collection(
&mut self,
collection_name: &str,
) -> QdrantResult<()>
pub async fn delete_collection( &mut self, collection_name: &str, ) -> QdrantResult<()>
Delete a collection.
Sourcepub async fn delete_points(
&mut self,
collection_name: &str,
point_ids: &[u64],
) -> QdrantResult<()>
pub async fn delete_points( &mut self, collection_name: &str, point_ids: &[u64], ) -> QdrantResult<()>
Delete points by ID from a collection.
Auto Trait Implementations§
impl !Freeze for QdrantDriver
impl !RefUnwindSafe for QdrantDriver
impl Send for QdrantDriver
impl Sync for QdrantDriver
impl Unpin for QdrantDriver
impl !UnwindSafe for QdrantDriver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more