//! Perf: `cargo test -p notescraft-knowledge --release -- --ignored --nocapture`. use std::time::Instant; use notescraft_knowledge::Index; use notescraft_knowledge::tokens::query_terms; const NOTES: usize = 10_000; #[test] #[ignore = "perf"] fn ten_thousand_notes() { let mut i = Index::default(); let t = Instant::now(); for n in 0..NOTES { let body = format!("# Note {n}\n\nTopic{} discusses item{} and shared words.\n\n## Part\n\n{}\n", n % 97, n % 13, "filler text about things ".repeat(40)); i.update(&format!("f{}/n{n}.md", n % 50), &body).unwrap(); } println!("index {NOTES} notes: {:?}, {} passages", t.elapsed(), i.passage_count()); let t = Instant::now(); let hits = i.search(&query_terms("topic42 item7 shared"), 6).unwrap(); let took = t.elapsed(); println!("search: {took:?}, {} hits", hits.len()); assert_eq!(hits.len(), 6); assert!(took.as_millis() < 200); }