Skip to main content

VectorQuery

Struct VectorQuery 

Source
pub struct VectorQuery<'a> { /* private fields */ }
Expand description

Vector nearest-neighbor query.

Implementations§

Source§

impl<'a> VectorQuery<'a>

Source

pub fn new( vector: Vector<'a>, vector_field_name: impl Into<String>, num_results: usize, ) -> Self

Creates a vector nearest-neighbor query.

Source

pub fn with_filter(self, filter_expression: FilterExpression) -> Self

Attaches a filter expression.

Source

pub fn set_filter(&mut self, filter_expression: FilterExpression)

Replaces the filter expression in place.

Source

pub fn with_ef_runtime(self, ef_runtime: usize) -> Self

Sets the runtime EF parameter (HNSW indexes).

Source

pub fn set_ef_runtime(&mut self, ef_runtime: usize)

Replaces the runtime EF parameter in place.

Source

pub fn ef_runtime(&self) -> Option<usize>

Returns the current EF runtime setting.

Source

pub fn with_epsilon(self, epsilon: f64) -> Self

Sets the epsilon parameter for approximate search.

Source

pub fn set_epsilon(&mut self, epsilon: f64)

Replaces the epsilon parameter in place.

Source

pub fn epsilon(&self) -> Option<f64>

Returns the current epsilon setting.

Source

pub fn with_hybrid_policy(self, policy: HybridPolicy) -> Self

Sets the hybrid search policy.

Source

pub fn set_hybrid_policy(&mut self, policy: HybridPolicy)

Replaces the hybrid search policy in place.

Source

pub fn hybrid_policy(&self) -> Option<HybridPolicy>

Returns the current hybrid policy setting.

Source

pub fn with_batch_size(self, batch_size: usize) -> Self

Sets the batch size for BATCHES hybrid search policy.

Source

pub fn set_batch_size(&mut self, batch_size: usize)

Replaces the batch size in place.

Source

pub fn batch_size(&self) -> Option<usize>

Returns the current batch size setting.

Source

pub fn with_search_window_size(self, size: usize) -> Self

Sets the search window size (SVS-VAMANA indexes).

Source

pub fn set_search_window_size(&mut self, size: usize)

Replaces the search window size in place.

Source

pub fn search_window_size(&self) -> Option<usize>

Returns the current search window size setting.

Source

pub fn with_use_search_history(self, mode: SearchHistoryMode) -> Self

Sets the search history mode (SVS-VAMANA indexes).

Source

pub fn set_use_search_history(&mut self, mode: SearchHistoryMode)

Replaces the search history mode in place.

Source

pub fn use_search_history(&self) -> Option<SearchHistoryMode>

Returns the current search history mode.

Source

pub fn with_search_buffer_capacity(self, capacity: usize) -> Self

Sets the search buffer capacity (SVS-VAMANA indexes).

Source

pub fn set_search_buffer_capacity(&mut self, capacity: usize)

Replaces the search buffer capacity in place.

Source

pub fn search_buffer_capacity(&self) -> Option<usize>

Returns the current search buffer capacity.

Source

pub fn with_return_fields<I, S>(self, return_fields: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Replaces the return field list.

Source

pub fn paging(self, offset: usize, num: usize) -> Self

Updates the query limit.

Source

pub fn sort_by(self, field: impl Into<String>, direction: SortDirection) -> Self

Sets the sort field and direction.

Source

pub fn in_order(self, in_order: bool) -> Self

Enables or disables INORDER.

Source

pub fn with_dialect(self, dialect: u32) -> Self

Sets the query dialect.

Source

pub fn vector(&self) -> &Vector<'a>

Returns the encoded query vector.

Trait Implementations§

Source§

impl<'a> Clone for VectorQuery<'a>

Source§

fn clone(&self) -> VectorQuery<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for VectorQuery<'a>

Source§

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

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

impl PageableQuery for VectorQuery<'_>

Source§

fn paged(&self, offset: usize, num: usize) -> Self

Returns a cloned query with an updated LIMIT clause.
Source§

impl QueryString for VectorQuery<'_>

Source§

fn to_redis_query(&self) -> String

Builds a Redis Search query string.
Source§

fn params(&self) -> Vec<QueryParam>

Query parameters used with Redis PARAMS.
Source§

fn return_fields(&self) -> Vec<String>

Return fields requested by the query.
Source§

fn sort_by(&self) -> Option<SortBy>

Sort order requested by the query.
Source§

fn limit(&self) -> Option<QueryLimit>

Limit clause requested by the query.
Source§

fn dialect(&self) -> u32

Query dialect.
Source§

fn in_order(&self) -> bool

Whether the query should use INORDER.
Source§

fn render(&self) -> QueryRender

Builds the full query render, including search options and params.
Source§

fn no_content(&self) -> bool

Whether the query should use NOCONTENT.
Source§

fn scorer(&self) -> Option<String>

Optional scorer.
Source§

fn kind(&self) -> QueryKind

The processed result shape for this query.
Source§

fn should_unpack_json(&self) -> bool

Whether JSON search results should be unpacked into top-level fields when no explicit projection is requested.
Source§

fn geofilter(&self) -> Option<GeoFilter>

Optional geo-spatial filter for FT.SEARCH GEOFILTER clause.

Auto Trait Implementations§

§

impl<'a> Freeze for VectorQuery<'a>

§

impl<'a> RefUnwindSafe for VectorQuery<'a>

§

impl<'a> Send for VectorQuery<'a>

§

impl<'a> Sync for VectorQuery<'a>

§

impl<'a> Unpin for VectorQuery<'a>

§

impl<'a> UnsafeUnpin for VectorQuery<'a>

§

impl<'a> UnwindSafe for VectorQuery<'a>

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> 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> 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<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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