search: make component and content matching opt-in
Default search now uses exact key match only. Component matching (--fuzzy) and content search (--content) are explicit flags. This makes missing graph structure visible instead of silently falling back to broad matching.
This commit is contained in:
parent
12dd320a29
commit
15dedea322
2 changed files with 43 additions and 23 deletions
|
|
@ -77,6 +77,12 @@ enum Command {
|
|||
/// Show debug output for each pipeline stage
|
||||
#[arg(long)]
|
||||
debug: bool,
|
||||
/// Also match key components (e.g. "irc" matches "irc-access")
|
||||
#[arg(long)]
|
||||
fuzzy: bool,
|
||||
/// Also search node content (slow, use when graph search misses)
|
||||
#[arg(long)]
|
||||
content: bool,
|
||||
},
|
||||
/// Scan markdown files, index all memory units
|
||||
Init,
|
||||
|
|
@ -487,8 +493,8 @@ fn main() {
|
|||
let cli = Cli::parse();
|
||||
|
||||
let result = match cli.command {
|
||||
Command::Search { query, pipeline, expand, full, debug }
|
||||
=> cmd_search(&query, &pipeline, expand, full, debug),
|
||||
Command::Search { query, pipeline, expand, full, debug, fuzzy, content }
|
||||
=> cmd_search(&query, &pipeline, expand, full, debug, fuzzy, content),
|
||||
Command::Init => cmd_init(),
|
||||
Command::Migrate => cmd_migrate(),
|
||||
Command::Health => cmd_health(),
|
||||
|
|
@ -594,7 +600,7 @@ fn main() {
|
|||
|
||||
// ── Command implementations ─────────────────────────────────────────
|
||||
|
||||
fn cmd_search(terms: &[String], pipeline_args: &[String], expand: bool, full: bool, debug: bool) -> Result<(), String> {
|
||||
fn cmd_search(terms: &[String], pipeline_args: &[String], expand: bool, full: bool, debug: bool, fuzzy: bool, content: bool) -> Result<(), String> {
|
||||
use store::StoreView;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
|
|
@ -636,7 +642,7 @@ fn cmd_search(terms: &[String], pipeline_args: &[String], expand: bool, full: bo
|
|||
let terms_map: BTreeMap<String, f64> = query.split_whitespace()
|
||||
.map(|t| (t.to_lowercase(), 1.0))
|
||||
.collect();
|
||||
let (seeds, _) = search::match_seeds(&terms_map, &store);
|
||||
let (seeds, _) = search::match_seeds_opts(&terms_map, &store, fuzzy, content);
|
||||
seeds
|
||||
};
|
||||
|
||||
|
|
@ -668,7 +674,7 @@ fn cmd_search(terms: &[String], pipeline_args: &[String], expand: bool, full: bo
|
|||
let terms_map: BTreeMap<String, f64> = query.split_whitespace()
|
||||
.map(|t| (t.to_lowercase(), 1.0))
|
||||
.collect();
|
||||
let (seeds, direct_hits) = search::match_seeds(&terms_map, &view);
|
||||
let (seeds, direct_hits) = search::match_seeds_opts(&terms_map, &view, fuzzy, content);
|
||||
|
||||
if seeds.is_empty() {
|
||||
eprintln!("No results for '{}'", query);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue