diff --git a/backend/app/api/mcp_server.py b/backend/app/api/mcp_server.py index 248e13a..9796537 100644 --- a/backend/app/api/mcp_server.py +++ b/backend/app/api/mcp_server.py @@ -207,7 +207,7 @@ async def search_notes( if query: conditions.append( text( - "to_tsvector('french', coalesce(notes.items.title,'') || ' ' || notes.items.content)" + "to_tsvector('french', coalesce(title,'') || ' ' || content)" " @@ plainto_tsquery('french', :q)" ).bindparams(q=query) ) diff --git a/backend/tests/test_mcp.py b/backend/tests/test_mcp.py index 094aed0..2cfd97a 100644 --- a/backend/tests/test_mcp.py +++ b/backend/tests/test_mcp.py @@ -84,6 +84,13 @@ async def test_search_notes_retourne_liste(): assert data == [] +async def test_search_notes_fts_trouve_par_mot_cle(): + await create_note(title="TEST_MCP_note_fts", content="recette de cuisine française traditionnelle") + result = await search_notes(query="cuisine") + data = json.loads(result) + assert any(n["title"] == "TEST_MCP_note_fts" for n in data) + + async def test_create_note_outil(): result = await create_note(title="TEST_MCP_note_create", content="Contenu de test MCP") data = json.loads(result)