Add unit test for malformed Lucene query in OmniSearch

This commit is contained in:
Riz Ashraf committed 2026-09-27 09:46:08 +01:00
1 parent 01d3c22c57
commit 4139d8fcc7
1 file changed
+17
+17
View File
@@ -766,4 +766,21 @@ mod tests {
println!("OMNI RES: {}", omni_res);
assert!(omni_res.contains("omni-1"), "omni search should return results containing the task id");
}
#[tokio::test]
async fn test_omni_search_malformed_query() {
let dir = tempfile::tempdir().unwrap();
let state = Arc::new(MemoryState::new(dir.path().to_str().unwrap()));
let omni = OmniSearchHandler;
// Pass a malformed Lucene query (unclosed parenthesis)
let omni_res = omni
.execute(json!({"query": "title: (unclosed"}), state.clone())
.await;
assert!(omni_res.is_err());
let err_msg = omni_res.unwrap_err();
assert!(err_msg.contains("malformed Lucene syntax"));
}
}