searcher->searchPaged($query, $inApps, $page, $size); $results = array_filter($results, function (Result $result) { if (json_encode($result, JSON_HEX_TAG) === false) { $this->logger->warning("Skipping search result due to invalid encoding: {type: " . $result->type . ", id: " . $result->id . "}"); return false; } else { return true; } }); return new JSONResponse($results); } }