pub struct Query {
pub vector: Vec<f32>,
pub limit: usize,
pub filter: Option<Filter>,
pub with_payload: bool,
pub with_vector: bool,
pub expected_vector_space: Option<String>,
pub params: QueryParams,
}Expand description
A vector similarity query.
Fields§
§vector: Vec<f32>Query vector, which must match the collection dimension.
limit: usizeMaximum number of scored points to return.
filter: Option<Filter>Optional point filter applied before final ranking.
with_payload: boolWhether returned winners include their JSON payloads.
with_vector: boolWhether returned winners include their stored vectors.
expected_vector_space: Option<String>Optional vector-space identity that must match collection metadata.
params: QueryParamsExact or approximate execution controls.
Implementations§
Source§impl Query
impl Query
Sourcepub fn new(vector: impl IntoIterator<Item = f32>, limit: usize) -> Self
pub fn new(vector: impl IntoIterator<Item = f32>, limit: usize) -> Self
Creates a query using collection defaults for exact or approximate mode.
Sourcepub fn exact(vector: impl IntoIterator<Item = f32>, limit: usize) -> Self
pub fn exact(vector: impl IntoIterator<Item = f32>, limit: usize) -> Self
Creates a query that scores every eligible point.
Sourcepub fn approximate(vector: impl IntoIterator<Item = f32>, limit: usize) -> Self
pub fn approximate(vector: impl IntoIterator<Item = f32>, limit: usize) -> Self
Creates a query that uses deterministic LSH candidate discovery.
Sourcepub fn with_filter(self, filter: Filter) -> Self
pub fn with_filter(self, filter: Filter) -> Self
Adds a point filter.
Sourcepub fn with_payload(self) -> Self
pub fn with_payload(self) -> Self
Requests payloads for returned winners.
Sourcepub fn with_vector(self) -> Self
pub fn with_vector(self) -> Self
Requests stored vectors for returned winners.
Sourcepub fn in_vector_space(self, vector_space: impl Into<String>) -> Self
pub fn in_vector_space(self, vector_space: impl Into<String>) -> Self
Requires the collection to use the supplied vector-space identity.
Sourcepub fn with_params(self, params: QueryParams) -> Self
pub fn with_params(self, params: QueryParams) -> Self
Replaces the exact or approximate execution parameters.