Improve OmniSearch error handling to return Lucene syntax errors to LLM
This commit is contained in:
1 parent
1ea635cdcc
commit
48a1973ea6
1 file changed
+8
-4
@@ -341,10 +341,14 @@ impl McpTool for OmniSearchHandler {
|
||||
let req: OmniSearchTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||
let limit = req.limit.unwrap_or(5);
|
||||
let include_body = req.include_body.unwrap_or(false);
|
||||
let matches = {
|
||||
let idx = state.get_search_index();
|
||||
idx.search(&req.query, req.namespace.as_deref())
|
||||
.unwrap_or_default()
|
||||
let matches = match state.get_search_index().search(&req.query, req.namespace.as_deref()) {
|
||||
Ok(m) => m,
|
||||
Err(e) => {
|
||||
return Err(format!(
|
||||
"Search query failed (possibly malformed Lucene syntax). Error: {}",
|
||||
e
|
||||
));
|
||||
}
|
||||
};
|
||||
println!("OMNI SEARCH MATCHES: {:?}", matches);
|
||||
|
||||
|
||||
Reference in new issue
Block a user