Skip to main content

Doc

Struct Doc 

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

A typed document. BTreeMap gives deterministic snapshots and tie-breaks.

Implementations§

Source§

impl Doc

Source

pub fn add_vector_f32(&mut self, name: &str, vector: &[f32]) -> Result<()>

Source

pub fn add_vector_f64(&mut self, name: &str, vector: &[f64]) -> Result<()>

Source

pub fn add_vector_i8(&mut self, name: &str, vector: &[i8]) -> Result<()>

Source

pub fn add_vector_i16(&mut self, name: &str, vector: &[i16]) -> Result<()>

Source

pub fn add_vector_fp16(&mut self, name: &str, vector: &[u16]) -> Result<()>

Source

pub fn add_vector_fp16_f32(&mut self, name: &str, vector: &[f32]) -> Result<()>

Source

pub fn add_vector_i4(&mut self, name: &str, vector: &[i8]) -> Result<()>

Source

pub fn add_vector_binary32(&mut self, name: &str, vector: &[u8]) -> Result<()>

Source

pub fn add_vector_binary64(&mut self, name: &str, vector: &[u8]) -> Result<()>

Source

pub fn add_sparse_vector( &mut self, name: &str, indices: &[u32], values: &[f32], ) -> Result<()>

Source

pub fn add_sparse_vector_f32( &mut self, name: &str, indices: &[u32], values: &[f32], ) -> Result<()>

Source

pub fn add_sparse_vector_fp16( &mut self, name: &str, indices: &[u32], values: &[u16], ) -> Result<()>

Source

pub fn add_sparse_vector_fp16_f32( &mut self, name: &str, indices: &[u32], values: &[f32], ) -> Result<()>

Source

pub fn get_vector_f32(&self, name: &str) -> Result<Option<Vec<f32>>>

Source

pub fn get_vector_f64(&self, name: &str) -> Result<Option<Vec<f64>>>

Source

pub fn get_vector_fp16(&self, name: &str) -> Result<Option<Vec<u16>>>

Source

pub fn get_vector_i4(&self, name: &str) -> Result<Option<Vec<i8>>>

Source

pub fn get_vector_i8(&self, name: &str) -> Result<Option<Vec<i8>>>

Source

pub fn get_vector_i16(&self, name: &str) -> Result<Option<Vec<i16>>>

Source

pub fn get_vector_binary32(&self, name: &str) -> Result<Option<Vec<u8>>>

Source

pub fn get_vector_binary64(&self, name: &str) -> Result<Option<Vec<u8>>>

Source

pub fn get_sparse_vector_f32( &self, name: &str, ) -> Result<Option<(Vec<u32>, Vec<f32>)>>

Source

pub fn get_sparse_vector_fp16( &self, name: &str, ) -> Result<Option<(Vec<u32>, Vec<u16>)>>

Source§

impl Doc

Source

pub fn new() -> Result<Self>

Source

pub fn with_pk(pk: impl Into<String>) -> Result<Self>

Source

pub fn set_pk(&mut self, pk: &str)

Sets the primary key. Empty keys are rejected at the collection write boundary so this method remains source-compatible with zvec’s () API.

Source

pub fn get_pk(&self) -> Option<&str>

Source

pub fn get_score(&self) -> f32

Source

pub fn score(&self) -> f32

Source

pub fn set_score(&mut self, score: f32) -> Result<()>

Source

pub fn doc_id(&self) -> Option<u64>

Returns the generation-local ordinal exposed by a query that requested document IDs. Ordinary input documents and queries without that option return None.

Source

pub fn field_count(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn has_field(&self, name: &str) -> bool

Source

pub fn is_field_null(&self, name: &str) -> bool

Source

pub fn field(&self, name: &str) -> Option<&FieldValue>

Source

pub fn vector(&self, name: &str) -> Option<&VectorValue>

Source

pub fn fields(&self) -> &BTreeMap<String, FieldValue>

Source

pub fn vectors(&self) -> &BTreeMap<String, VectorValue>

Source

pub fn set_field_value(&mut self, name: &str, value: FieldValue) -> Result<()>

Source

pub fn set_vector_value(&mut self, name: &str, value: VectorValue) -> Result<()>

Source

pub fn add_string(&mut self, name: &str, value: &str) -> Result<()>

Source

pub fn add_bool(&mut self, name: &str, value: bool) -> Result<()>

Source

pub fn add_i32(&mut self, name: &str, value: i32) -> Result<()>

Source

pub fn add_i64(&mut self, name: &str, value: i64) -> Result<()>

Source

pub fn add_u32(&mut self, name: &str, value: u32) -> Result<()>

Source

pub fn add_u64(&mut self, name: &str, value: u64) -> Result<()>

Source

pub fn add_f32(&mut self, name: &str, value: f32) -> Result<()>

Source

pub fn add_f64(&mut self, name: &str, value: f64) -> Result<()>

Source

pub fn add_binary(&mut self, name: &str, value: &[u8]) -> Result<()>

Source

pub fn add_array_binary(&mut self, name: &str, values: &[Vec<u8>]) -> Result<()>

Source

pub fn add_array_string(&mut self, name: &str, values: &[&str]) -> Result<()>

Source

pub fn add_array_i32(&mut self, name: &str, values: &[i32]) -> Result<()>

Source

pub fn add_array_i64(&mut self, name: &str, values: &[i64]) -> Result<()>

Source

pub fn add_array_u32(&mut self, name: &str, values: &[u32]) -> Result<()>

Source

pub fn add_array_u64(&mut self, name: &str, values: &[u64]) -> Result<()>

Source

pub fn add_array_f32(&mut self, name: &str, values: &[f32]) -> Result<()>

Source

pub fn add_array_f64(&mut self, name: &str, values: &[f64]) -> Result<()>

Source

pub fn add_array_bool(&mut self, name: &str, values: &[bool]) -> Result<()>

Source

pub fn set_field_null(&mut self, name: &str) -> Result<()>

Source

pub fn remove_field(&mut self, name: &str) -> Result<()>

Source

pub fn clear(&mut self)

Source

pub fn get_string(&self, name: &str) -> Result<Option<String>>

Source

pub fn get_bool(&self, name: &str) -> Result<Option<bool>>

Source

pub fn get_i32(&self, name: &str) -> Result<Option<i32>>

Source

pub fn get_i64(&self, name: &str) -> Result<Option<i64>>

Source

pub fn get_u32(&self, name: &str) -> Result<Option<u32>>

Source

pub fn get_u64(&self, name: &str) -> Result<Option<u64>>

Source

pub fn get_f32(&self, name: &str) -> Result<Option<f32>>

Source

pub fn get_f64(&self, name: &str) -> Result<Option<f64>>

Source

pub fn get_binary(&self, name: &str) -> Result<Option<Vec<u8>>>

Source

pub fn get_array_i32(&self, name: &str) -> Result<Option<Vec<i32>>>

Source

pub fn get_array_i64(&self, name: &str) -> Result<Option<Vec<i64>>>

Source

pub fn get_array_u32(&self, name: &str) -> Result<Option<Vec<u32>>>

Source

pub fn get_array_u64(&self, name: &str) -> Result<Option<Vec<u64>>>

Source

pub fn get_array_f32(&self, name: &str) -> Result<Option<Vec<f32>>>

Source

pub fn get_array_f64(&self, name: &str) -> Result<Option<Vec<f64>>>

Source

pub fn get_array_bool(&self, name: &str) -> Result<Option<Vec<bool>>>

Source

pub fn project( &self, output_fields: Option<&[String]>, include_vector: bool, ) -> Self

Returns a projection suitable for query/fetch output.

Trait Implementations§

Source§

impl Clone for Doc

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Doc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Doc

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Doc

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Doc

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Doc

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Doc

Auto Trait Implementations§

§

impl Freeze for Doc

§

impl RefUnwindSafe for Doc

§

impl Send for Doc

§

impl Sync for Doc

§

impl Unpin for Doc

§

impl UnsafeUnpin for Doc

§

impl UnwindSafe for Doc

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.