Skip to main content

nodedb_query/
text_search.rs

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