Expand description
Query routing and intent detection for intelligent search.
This module provides query analysis capabilities to determine the best search strategy based on user intent. It helps route queries to the appropriate search backend or external tools like loctree.
§Architecture
Query -> [Intent Detection] -> QueryIntent
-> [Query Router] -> RoutingDecision
├── Temporal → Date filtering + timestamp priority
├── Structural → Delegate to loctree
├── Semantic → Pure vector search
├── Exact → BM25 keyword match
└── Hybrid → Vector + BM25 fusion§Usage
use rust_memex::query::{detect_intent, QueryIntent, QueryRouter};
// Quick intent detection
let intent = detect_intent("when did we buy dragon");
assert!(matches!(intent, QueryIntent::Temporal));
// Full routing with recommendations
let router = QueryRouter::new();
let decision = router.route("what imports main.rs");
if let Some(suggestion) = decision.loctree_suggestion {
println!("Suggested: {}", suggestion.command);
}Re-exports§
pub use router::LoctreeSuggestion;pub use router::QueryIntent;pub use router::QueryRouter;pub use router::RecommendedSearchMode;pub use router::RoutingDecision;pub use router::SearchModeRecommendation;pub use router::TemporalHints;pub use router::detect_intent;
Modules§
- router
- Query intent detection and routing for intelligent search.