Make a non-matching name filter return an empty result - #212
Merged
Conversation
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.
Owner
Author
|
Suite de revue — deux retouches poussées :
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
nameFilterSetcollapsed three different cases intoNothing: no query, no BM25 index, and a query whose fuzzy expansion matches nothing. The downstream predicate treatsNothingas accept-every-pid, so a name that matched nothing silently disabled the filter — supply-chain and consumers returned every entry, with afilteredActivitiescount to match, and the caller could not tell "no match" from "no filter" (?name=zzznomatchreturned 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.