Skip to content

Stop Special:Search failing when no Elasticsearch query was run - #288

Draft
JeroenDeDauw wants to merge 1 commit into
masterfrom
fix/empty-search-result-set
Draft

JeroenDeDauw wants to merge 1 commit into
masterfrom
fix/empty-search-result-set

Conversation

@JeroenDeDauw

@JeroenDeDauw JeroenDeDauw commented Sep 8, 2026

Copy link
Copy Markdown
Member

CirrusSearch answers with an EmptySearchResultSet whenever it decides up front that nothing can match — for
instance incategory:id: with a page id that does not exist, an unknown deepcat: category, or a malformed
regex. That result set carries no Elastica result set, which the SpecialSearchResults handler dereferenced
unconditionally, so any such search on a configured wiki produced "Call to a member function getQuery() on null"
instead of a results page. The handler now records the current query only when there is one; the append handler
already renders no sidebar in that case. Tests cover both kinds of result set.

Considered, omitted: rendering the facets with empty counts as action=wbfacetsearch does, by reusing its builder
in the sidebar.

AI-authored — Claude Code, Opus 5 (max); one-line ask from @JeroenDeDauw covering three review findings, one
PR each; no redirections; diff not yet human-reviewed; regression tests seen failing then passing, full extension
PHPUnit suite, phpcs and phpstan clean, and the failing search reproduced and re-checked on a dev wiki.

@codecov-commenter

codecov-commenter commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.15%. Comparing base (f41af94) to head (33275af).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #288      +/-   ##
============================================
+ Coverage     75.51%   77.15%   +1.63%     
- Complexity      429      430       +1     
============================================
  Files            50       50              
  Lines          1401     1405       +4     
============================================
+ Hits           1058     1084      +26     
+ Misses          343      321      -22     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JeroenDeDauw
JeroenDeDauw force-pushed the fix/empty-search-result-set branch from 2344255 to 1ffb57a Compare September 8, 2026 23:28
CirrusSearch answers with an `EmptySearchResultSet` whenever it decides up front that nothing can match — for
instance `incategory:id:` with a page id that does not exist, an unknown `deepcat:` category, or a malformed
regex. That result set carries no Elastica result set, which the `SpecialSearchResults` handler dereferenced
unconditionally, so any such search on a configured wiki produced "Call to a member function getQuery() on null"
instead of a results page. The handler now records the current query only when there is one; the append handler
already renders no sidebar in that case. Tests cover both kinds of result set.

Considered, omitted: rendering the facets with empty counts as `action=wbfacetsearch` does, by reusing its builder
in the sidebar.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@JeroenDeDauw
JeroenDeDauw force-pushed the fix/empty-search-result-set branch from 1ffb57a to 33275af Compare September 8, 2026 23:33
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.

2 participants