Skip to content

No current controller when indexing for search #1338

@lianna-blanca

Description

@lianna-blanca

The function getContentForSearchIndex() is often used by default for indexing content for search.

However we've frequently run into an issue in which the indexing process's queued job is halted by an error:

{"exception":"[object] (Exception(code: 512): No current controller available in /var/www/mysite/releases/0000000000/vendor/silverstripe/framework/src/Control/Controller.php at line 524 at /var/www/mysite/releases/0000000000/vendor/symbiote/silverstripe-queuedjobs/src/Services/JobErrorHandler.php:41)"}

This happens on elemental content that is calling a controller as part of its normal functions, e.g. a form block, which has a page controller during normal rendering, but as the search indexing doesn't have that context, it hits the forTemplate() function within getContentForSearchIndex() and breaks.

There are some clunky ways to work around this, but if possible we would like to see an option to index elemental content without hitting forTemplate() or similar functions.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions