Skip to content

Make a non-matching name filter return an empty result - #212

Merged
ccomb merged 3 commits into
mainfrom
supply-chain-name-filter
Jul 15, 2026
Merged

Make a non-matching name filter return an empty result#212
ccomb merged 3 commits into
mainfrom
supply-chain-name-filter

Conversation

@ccomb

@ccomb ccomb commented Jul 14, 2026

Copy link
Copy Markdown
Owner

nameFilterSet collapsed three different cases into Nothing: no query, no BM25 index, and a query whose fuzzy expansion matches nothing. The downstream predicate treats Nothing as accept-every-pid, so a name that matched nothing silently disabled the filter — supply-chain and consumers returned every entry, with a filteredActivities count to match, and the caller could not tell "no match" from "no filter" (?name=zzznomatch returned 790 entries on Agribalyse).

A present, non-blank query on an indexed database now yields the real match set, empty included. Absent or blank queries and index-less databases keep the accept-all behavior. One shared helper, so the fix covers supply-chain and consumers on both the REST and MCP surfaces. Covered by two new specs (supply-chain and consumers) next to the existing fuzzy-filter tests.

ccomb added 2 commits July 14, 2026 23:34
nameFilterSet collapsed three different cases into Nothing: no query,
no BM25 index, and a query whose fuzzy expansion matches nothing. The
downstream predicate treats Nothing as accept-every-pid, so a name that
matched nothing silently disabled the filter — supply-chain and
consumers returned every entry, with a filteredActivities count to
match, and the caller could not tell "no match" from "no filter".

A present, non-blank query on an indexed database now yields the real
match set, empty included. Absent or blank queries and index-less
databases (bare test fixtures) keep the accept-all behavior. One shared
helper, so the fix covers supply-chain and consumers on both the REST
and MCP surfaces.
A punctuation-only query survives the blank check but tokenizes to
nothing; the spec fixes that it now means "matches nothing", not "no
filter". The bm25MatchingPids docstring still described Nothing as
"no filter" — after this branch that reading is the caller's decision,
and nameFilterSet decides the opposite for a present query.
@ccomb

ccomb commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

Suite de revue — deux retouches poussées :

  • Docstring de bm25MatchingPids alignée : elle décrivait encore Nothing comme « no filter », alors que l'appelant décide désormais — nameFilterSet traite une requête présente mais sans expansion comme « rejeter tout ».
  • Cas de bord épinglé : une requête faite uniquement de ponctuation ("???") passe le test du blanc mais tokenise à vide ; un spec fixe qu'elle retourne zéro entrée (une requête qui ne matche rien, pas une absence de filtre).

@ccomb
ccomb merged commit d4c53e6 into main Jul 15, 2026
9 checks passed
@ccomb
ccomb deleted the supply-chain-name-filter branch July 15, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant