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 req: OmniSearchTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||||
let limit = req.limit.unwrap_or(5);
|
let limit = req.limit.unwrap_or(5);
|
||||||
let include_body = req.include_body.unwrap_or(false);
|
let include_body = req.include_body.unwrap_or(false);
|
||||||
let matches = {
|
let matches = match state.get_search_index().search(&req.query, req.namespace.as_deref()) {
|
||||||
let idx = state.get_search_index();
|
Ok(m) => m,
|
||||||
idx.search(&req.query, req.namespace.as_deref())
|
Err(e) => {
|
||||||
.unwrap_or_default()
|
return Err(format!(
|
||||||
|
"Search query failed (possibly malformed Lucene syntax). Error: {}",
|
||||||
|
e
|
||||||
|
));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
println!("OMNI SEARCH MATCHES: {:?}", matches);
|
println!("OMNI SEARCH MATCHES: {:?}", matches);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user