Skip to content

Admin search silently returns no page results when a configured search field has been deleted #2263

@adrianbj

Description

@adrianbj

If a field configured in ProcessPageSearch's search fields is later deleted, the admin live search silently returns zero page results — no error, no warning, no log entry — even for a superuser. Other result types (users, modules, templates, etc.) still work, so it can look like a partial/intermittent failure rather than a config problem.

What happened

I deleted a custom field from a site but left it referenced in the ProcessPageSearch settings (it was still listed in both Search fields and Search fields (ajax/live)). After that, the admin search box stopped returning any page results. There was no indication why — it just came back empty.

The search builds a single OR selector from the configured fields, e.g.:

title|first_name|email|coupon_code|deleted_field%=query

When PageFinder reaches the deleted field it throws PageFinderSyntaxException("Field does not exist: deleted_field") (wire/core/PageFinder/PageFinder.php, in getQueryFieldFulltext()). That exception propagates up to $pages->find() inside ProcessPageSearchLive::findPages(), where it's caught and discarded silently:

  // wire/modules/Process/ProcessPageSearch/ProcessPageSearchLive.php
  try {
      if($this->useType('pages', $liveSearch['type'])) {
          $selector .= ', templates_id!=' . implode('|', $config->userTemplateIDs);
          $items['pages'] = $pages->find("$selector, status<" . Page::statusTrash);
      }
  } catch(\Exception $e) {
  }

The empty catch means the whole page-results branch is dropped with no feedback.

How to reproduce

  1. Add an existing field to ProcessPageSearch → Search fields (and the ajax/live list).
  2. Delete that field.
  3. Use the admin search box for anything that should match a page.

Expected: results return (the invalid field is ignored), and/or an error/log entry explains the problem.
Actual: zero page results, no error, no log entry.

Suggested fixes (either or both)

  1. Don't swallow the exception silently in findPages() — log it / surface a notice so the failure is diagnosable instead of invisible. Better still, skip unknown fields and continue so search degrades gracefully.
  2. More robustly, have ProcessPageSearch hook field deletion (e.g. Fields::deleted) to prune removed fields from its searchFields/searchFields2 config, so a stale reference never persists in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions