Skip to content

Search for 0 and get the accounts matching it - #717

Merged
blaipr merged 1 commit into
mainfrom
fix/account-search-for-zero
Aug 13, 2026
Merged

Search for 0 and get the accounts matching it#717
blaipr merged 1 commit into
mainfrom
fix/account-search-for-zero

Conversation

@blaipr

@blaipr blaipr commented Aug 13, 2026

Copy link
Copy Markdown
Member

The bug

PHP reads the string "0" as empty, and three guards between the search box and the query used empty() to mean nothing was typed:

AccountSearchTokenizer::tokenizeFrom() returned null for a query of just 0
AccountSearch::getByFilter() (service) skipped the tokenizer entirely
AccountSearch::buildTextFilter() (repository) dropped the text condition

The first alone was enough: the request went out with no text filter at all, so a user searching for 0 got the whole unfiltered list back — not "no matches", which would at least have looked like an answer.

Reachable from the account search box and from the API's text parameter.

The fix

Each of the three compares against the empty string instead. 0 is a search term like any other: a host ending in one, a version number, a note that mentions it.

Testing

Two tests, one at each end: the service keeps 0 as the cleaned search text rather than discarding it, and the repository binds %0% into the four LIKE conditions rather than emitting no condition. The existing empty-search test stays as it was.

Both suites green: 3049 unit, 813 integration.

(Replaces #714 — GitHub never picked up the pushes to that branch.)

PHP reads the string "0" as empty, and three guards on the way from the search
box to the query used empty() to mean "nothing was typed". So a search for 0
was dropped at the first of them, the request went out carrying no text filter
at all, and the user got the whole unfiltered list back — not no matches, which
would at least have looked like an answer.

The tokenizer, the search service and the repository each compare against the
empty string instead. 0 is a term like any other: a host ending in one, a
version, a note that mentions it.

Reachable from the search box and from the API's text parameter.
@blaipr
blaipr merged commit 79aeae1 into main Aug 13, 2026
8 checks passed
@blaipr
blaipr deleted the fix/account-search-for-zero branch August 13, 2026 17:15
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