Skip to content

Commit a95e146

Browse files
authored
Implement KD Tree indexer (#51)
* Resolve merge with refactor * Fix merge residues * Update Cargo.lock * Debug without rebuild * Add rebuild * Add tests * Refactor code * Add OrdF32, add axis field * Move helpers to impl KDTree
1 parent edc992d commit a95e146

10 files changed

Lines changed: 1244 additions & 277 deletions

File tree

‎Cargo.lock‎

Lines changed: 30 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/defs/src/error.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ pub enum DbError {
99
DeserializationError,
1010
IndexError(String),
1111
LockError,
12+
IndexInitError, //TODO: Change this
13+
UnsupportedSimilarity,
1214
DimensionMismatch,
1315
InvalidDimension { expected: Dimension, got: Dimension },
1416
PointAlreadyExists { id: PointId },

‎crates/defs/src/types.rs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ impl<'q> Eq for DistanceOrderedVector<'q> {}
9292
// Context(ContextQuery<VectorInternal>),
9393
// }
9494

95-
#[derive(Clone, Copy, Debug, PartialEq)]
96-
pub struct OrdF32(f32);
95+
#[derive(Clone, Copy, Debug, PartialEq, Default)]
96+
pub struct OrdF32(pub f32);
9797

9898
impl OrdF32 {
9999
pub fn new(x: f32) -> Self {
@@ -117,3 +117,9 @@ impl PartialOrd for OrdF32 {
117117
Some(self.cmp(other))
118118
}
119119
}
120+
121+
impl From<f32> for OrdF32 {
122+
fn from(x: f32) -> Self {
123+
Self(x)
124+
}
125+
}

0 commit comments

Comments
 (0)