Skip to content

🐛 Skip empty result section when accelerator has enable_enlarge=false#920

Open
AlxFrst wants to merge 1 commit into
Combodo:developfrom
AlxFrst:fix/empty-accelerator-section-when-enlarge-disabled
Open

🐛 Skip empty result section when accelerator has enable_enlarge=false#920
AlxFrst wants to merge 1 commit into
Combodo:developfrom
AlxFrst:fix/empty-accelerator-section-when-enlarge-disabled

Conversation

@AlxFrst
Copy link
Copy Markdown

@AlxFrst AlxFrst commented May 27, 2026

Summary

Fixes #919.

When full_text_accelerators is configured with enable_enlarge => false for a class, the global search still rendered an empty "0 result" section for that class. The block contained no actionable content (no Enlarge button, by configuration) and only added visual clutter, especially on instances with several accelerators configured this way.

This PR aligns the rendering with the existing enable_enlarge semantic: when the action is explicitly disabled, the empty section is no longer rendered.

Cause

In pages/ajax.render.php (~ line 1424), the empty result block was rendered for every accelerated class regardless of the enable_enlarge value. The flag only governed whether the button was shown inside the header, not whether the section itself should appear when there was no match.

Fix

Wrap the empty-section rendering in a check for enable_enlarge !== false. The check defaults to enabled when the key is absent, preserving the current behavior for any configuration that doesn't opt into the new behavior.

Compatibility

enable_enlarge 0 result N > 0 results
not set (default) rendered (unchanged) rendered (unchanged)
true rendered (unchanged) rendered (unchanged)
false not rendered (this PR) rendered (unchanged)

Strictly opt-in via existing configuration. Only impacts configurations that explicitly set enable_enlarge => false, where the current behavior was arguably a bug.

Test plan

  • PHP lint passes on the modified file
  • Manual: accelerator with enable_enlarge => false, search with no match → empty section no longer appears
  • Manual: accelerator with enable_enlarge => true (or omitted), search with no match → empty section still appears with the Enlarge button
  • Manual: results page with N>0 matches is unchanged in both cases

Refs Combodo#919

When 'full_text_accelerators' is configured with 'enable_enlarge' => false
for a class, the global search no longer renders the empty "0 result"
section for that class. Without the Enlarge button, the section had no
actionable content and only added visual clutter on instances configured
with many such accelerators.

Behavior is unchanged when 'enable_enlarge' is true, omitted, or the
class has matching results.
Copy link
Copy Markdown
Contributor

@Hipska Hipska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this have been cleaner to add?

if (array_key_exists($sClassName, $aAccelerators)
    && (!array_key_exists('enable_enlarge', $aAccelerators[$sClassName])
        || $aAccelerators[$sClassName]['enable_enlarge'] !== false)) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending review

Development

Successfully merging this pull request may close these issues.

Empty result section is rendered for accelerated classes even when enable_enlarge is false

3 participants