Skip to content

Commit 2900c6d

Browse files
committed
chore(agentic): process single quotes in user queries
Signed-off-by: Xin Liu <sam@secondstate.io>
1 parent 5a12e1f commit 2900c6d

File tree

1 file changed

+24
-1
lines changed
  • cardea-agentic-search/cardea-agentic-search-mcp-server/src

1 file changed

+24
-1
lines changed

cardea-agentic-search/cardea-agentic-search-mcp-server/src/search.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,30 @@ impl AgenticSearchServer {
564564
}
565565

566566
// execute full-text search
567-
let query = keywords.as_ref();
567+
568+
// ! Do not remove this block
569+
{
570+
// let search_sql = format!(
571+
// r"SELECT * FROM {}
572+
// WHERE fts_match_word(?, content)
573+
// ORDER BY fts_match_word(?, content)
574+
// DESC LIMIT ?",
575+
// config.table_name
576+
// );
577+
578+
// let hits: Vec<TidbSearchHit> = conn
579+
// .exec(&search_sql, (query.clone(), query, config.limit))
580+
// .map_err(|e| {
581+
// let error_message = format!("Failed to execute search: {e}");
582+
583+
// error!(error_message);
584+
585+
// McpError::new(ErrorCode::INTERNAL_ERROR, error_message, None)
586+
// })?;
587+
}
588+
589+
let query = keywords.as_ref().replace("'", "''"); // ! This is a workaround for the issue that the query contains single quotes.
590+
568591
debug!("\nExecuting full-text search for '{}'...", query);
569592
let search_sql = format!(
570593
r"SELECT * FROM {}

0 commit comments

Comments
 (0)