review(p9-fb-10-task5): promote lexical_query to common + tighten Korean hit assertion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-03 10:14:17 +00:00
parent 60e583252e
commit 3f0b00439a
3 changed files with 28 additions and 33 deletions

View File

@@ -7,15 +7,6 @@ mod common;
use common::TestEnv;
fn lexical_query(text: &str) -> kebab_core::SearchQuery {
kebab_core::SearchQuery {
text: text.to_string(),
mode: kebab_core::SearchMode::Lexical,
k: 10,
filters: kebab_core::SearchFilters::default(),
}
}
/// p9-fb-10 — A Korean token present in a Hangul document must survive
/// the ingest → FTS5 → search round-trip. NFC normalization is wired
/// upstream in `kebab-normalize`; this test just verifies the facade
@@ -37,7 +28,7 @@ fn korean_lexical_query_returns_korean_document() {
.expect("ingest must succeed");
// Lexical search for "러스트" — must return the Korean document.
let hits = kebab_app::search_with_config(env.config.clone(), lexical_query("러스트"))
let hits = kebab_app::search_with_config(env.config.clone(), common::lexical_query("러스트"))
.expect("search must succeed");
assert!(
@@ -46,12 +37,12 @@ fn korean_lexical_query_returns_korean_document() {
);
// At least one hit must reference our Korean document.
let any_korean = hits.iter().any(|h| {
let p = &h.doc_path.0;
p.contains("러스트") || p.contains("비동기")
});
// "러스트-비동기" is the exact filename stem — a single combined
// check is unambiguous and avoids false positives from other docs.
let any_korean = hits.iter().any(|h| h.doc_path.0.contains("러스트-비동기"));
assert!(
any_korean,
"expected a hit referencing the Korean document; got: {hits:#?}"
"expected at least one hit on the Korean fixture doc, got: {:?}",
hits.iter().map(|h| &h.doc_path.0).collect::<Vec<_>>()
);
}