velesdb-core 3.0.0

High-performance vector database engine written in Rust
Documentation
//! Search implementation for Collection.
//!
//! This module provides all search functionality for VelesDB collections:
//! - Vector similarity search (HNSW)
//! - Full-text search (BM25)
//! - Hybrid search (vector + text with RRF fusion)
//! - Batch and multi-query search
//! - VelesQL query execution

mod batch;
#[cfg(test)]
mod batch_tests;
#[cfg(test)]
mod distance_semantics_tests;
pub mod query;
#[cfg(test)]
mod query_validation_tests;
pub(crate) mod resolve;
#[cfg(test)]
mod similarity_exec_tests;
mod sparse;
#[cfg(test)]
mod sparse_tests;
mod text;
#[cfg(test)]
mod text_tests;
mod vector;
#[cfg(test)]
mod vector_dispatch_parity_tests;
mod vector_filter;
#[cfg(test)]
mod vector_filter_tests;
#[cfg(test)]
mod vector_tests;

// Re-export all search methods via trait implementations
// The actual impl blocks are in submodules

/// Wrapper for f32 to implement Ord for `BinaryHeap` in hybrid search.
#[derive(Debug, Clone, Copy, PartialEq)]
pub(crate) struct OrderedFloat(pub f32);

impl Eq for OrderedFloat {}

impl PartialOrd for OrderedFloat {
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}

impl Ord for OrderedFloat {
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        // total_cmp gives a true total order: NaN is considered greater than any
        // finite value. Callers wrap in Reverse<(OrderedFloat, _)> for a min-heap,
        // so Reverse(NaN) is the minimum and is discarded first — NaN scores never
        // survive to the output list.
        self.0.total_cmp(&other.0)
    }
}