From 909f36613db5d423f032557329519824f7ed2381 Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Wed, 17 Jun 2026 22:54:24 +0200 Subject: [PATCH] =?UTF-8?q?test(integration):=20address=20round-2=20review?= =?UTF-8?q?=20=E2=80=94=20searchability=20robustness?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bump nc_semantic_search limit 10->50 in document_is_searchable: a freshly indexed note can rank below seed data (e.g. deck cards) in a crowded corpus, and the query is cheap. - Fix the note_id-less fallback to token-match (all words present) instead of contiguous-substring match, so multi-word search terms work when a caller omits note_id. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/integration/_search_helpers.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/integration/_search_helpers.py b/tests/integration/_search_helpers.py index db531c7d..65800bed 100644 --- a/tests/integration/_search_helpers.py +++ b/tests/integration/_search_helpers.py @@ -23,7 +23,9 @@ async def document_is_searchable( try: search = await mcp_client.call_tool( "nc_semantic_search", - arguments={"query": search_term, "limit": 10, "score_threshold": 0.0}, + # limit is generous: a fresh note can sit below seed data (e.g. deck + # cards) in a crowded corpus, and the query is cheap. + arguments={"query": search_term, "limit": 50, "score_threshold": 0.0}, ) except Exception as e: # transient transport/availability blip — keep polling logger.debug("Semantic search poll failed: %s", e) @@ -33,11 +35,15 @@ async def document_is_searchable( return False results = json.loads(search.content[0].text).get("results", []) - needle = search_term.lower() + # Token match (not contiguous substring) so multi-word terms work in the + # note_id-less fallback path. + tokens = search_term.lower().split() for r in results: if note_id is not None: if r.get("id") == note_id and r.get("doc_type") == "note": return True - elif needle in f"{r.get('title', '')} {r.get('excerpt', '')}".lower(): - return True + else: + haystack = f"{r.get('title', '')} {r.get('excerpt', '')}".lower() + if tokens and all(t in haystack for t in tokens): + return True return False