Skip to content

Commit

Permalink
Remove has vector condition builder, follow pattern of other conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
timvisee committed Jan 15, 2025
1 parent a8bf329 commit 3951c57
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 43 deletions.
38 changes: 0 additions & 38 deletions src/builders/has_vector_condition_builder.rs

This file was deleted.

3 changes: 0 additions & 3 deletions src/builders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ pub use create_collection_builder::CreateCollectionBuilder;
pub mod count_points_builder;
pub use count_points_builder::*;

pub mod has_vector_condition_builder;
pub use has_vector_condition_builder::HasVectorConditionBuilder;

pub mod dense_vector_builder;
pub use dense_vector_builder::DenseVectorBuilder;

Expand Down
24 changes: 22 additions & 2 deletions src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::qdrant::points_selector::PointsSelectorOneOf;
use crate::qdrant::r#match::MatchValue;
use crate::qdrant::{
self, Condition, DatetimeRange, FieldCondition, Filter, GeoBoundingBox, GeoPolygon, GeoRadius,
HasIdCondition, IsEmptyCondition, IsNullCondition, MinShould, NestedCondition, PointId,
PointsSelector, Range, ValuesCount,
HasIdCondition, HasVectorCondition, IsEmptyCondition, IsNullCondition, MinShould,
NestedCondition, PointId, PointsSelector, Range, ValuesCount,
};

impl From<Filter> for PointsSelector {
Expand Down Expand Up @@ -47,6 +47,14 @@ impl From<HasIdCondition> for Condition {
}
}

impl From<HasVectorCondition> for Condition {
fn from(has_vector_condition: HasVectorCondition) -> Self {
Condition {
condition_one_of: Some(ConditionOneOf::HasVector(has_vector_condition)),
}
}
}

impl From<Filter> for Condition {
fn from(filter: Filter) -> Self {
Condition {
Expand Down Expand Up @@ -180,6 +188,18 @@ impl qdrant::Condition {
})
}

/// Create a [`Condition`] to check if the point has a specific named vector.
///
/// # Examples:
/// ```
/// qdrant_client::qdrant::Condition::has_vector("my_vector");
/// ```
pub fn has_vector(vector_name: impl Into<String>) -> Self {
Self::from(qdrant::HasVectorCondition {
has_vector: vector_name.into(),
})
}

/// Create a [`Condition`] that matches a field against a certain value.
///
/// # Examples:
Expand Down

0 comments on commit 3951c57

Please sign in to comment.