Skip to main content

nodedb_query/
text_search.rs

1//! Full-text search re-exports from `nodedb-fts`.
2//!
3//! Query-layer code that needs BM25 scoring, analyzers, or fuzzy matching
4//! imports from here. The implementation lives in the shared `nodedb-fts` crate.
5//!
6//! Lite: uses `engine::fts::FtsCollectionManager` (wraps `FtsIndex<MemoryBackend>`).
7//! Origin: uses `engine::sparse::fts_redb` (wraps `FtsIndex<RedbBackend>`).
8
9pub use nodedb_fts::FtsIndex;
10pub use nodedb_fts::analyzer::pipeline::analyze;
11pub use nodedb_fts::backend::FtsBackend;
12pub use nodedb_fts::backend::memory::MemoryBackend;
13pub use nodedb_fts::posting::{Bm25Params, MatchOffset, Posting, QueryMode, TextSearchResult};
14
15#[cfg(test)]
16mod tests {
17    use super::*;
18
19    #[test]
20    fn analyze_basic() {
21        let tokens = analyze("The quick brown fox jumps over the lazy dog");
22        assert!(!tokens.is_empty());
23        assert!(tokens.iter().all(|t| t != "the"));
24    }
25}