rust_memex/query/mod.rs
1//! Query routing and intent detection for intelligent search.
2//!
3//! This module provides query analysis capabilities to determine the best
4//! search strategy based on user intent. It helps route queries to the
5//! appropriate search backend or external tools like loctree.
6//!
7//! # Architecture
8//!
9//! ```text
10//! Query -> [Intent Detection] -> QueryIntent
11//! -> [Query Router] -> RoutingDecision
12//! ├── Temporal → Date filtering + timestamp priority
13//! ├── Structural → Delegate to loctree
14//! ├── Semantic → Pure vector search
15//! ├── Exact → BM25 keyword match
16//! └── Hybrid → Vector + BM25 fusion
17//! ```
18//!
19//! # Usage
20//!
21//! ```rust
22//! use rust_memex::query::{detect_intent, QueryIntent, QueryRouter};
23//!
24//! // Quick intent detection
25//! let intent = detect_intent("when did we buy dragon");
26//! assert!(matches!(intent, QueryIntent::Temporal));
27//!
28//! // Full routing with recommendations
29//! let router = QueryRouter::new();
30//! let decision = router.route("what imports main.rs");
31//! if let Some(suggestion) = decision.loctree_suggestion {
32//! println!("Suggested: {}", suggestion.command);
33//! }
34//! ```
35
36pub mod router;
37
38pub use router::{
39 LoctreeSuggestion, QueryIntent, QueryRouter, RecommendedSearchMode, RoutingDecision,
40 SearchModeRecommendation, TemporalHints, detect_intent,
41};