execCustomQuery(<<topicId])) { $topic = new Topic; $topic->id = $item->topicId; if ($db->fetch($topic)) $topicLookup[$topic->id] = $topic; } if (!isset($attachmentLookup[$item->id])) { $attachmentLookup[$item->id] = $db->fetchCustom(Attachment::class, 'WHERE post_id = $1', [ $item->id ]); } if (!isset($userLookup[$item->authorId])) { $user = new User; $user->id = $item->authorId; if ($db->fetch($user)) $userLookup[$item->authorId] = $user; } } $end_time = microtime(true); $search_duration = $end_time - $start_time; render("search.twig", [ "posts" => &$posts, "topics" => &$topicLookup, "users" => &$userLookup, "attachments" => &$attachmentLookup, "search_duration" => $search_duration, ]); } else { render("search.twig"); }