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.
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:
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.