$edition_id = ''; $edition = new Edition(); if (!empty($_GET['edition_id'])) { $edition_id = filter_input(INPUT_GET, 'edition_id', FILTER_SANITIZE_STRING); } $content->set('current_edition', $edition_id); /* * Display our search form. */ $search->query = $q; $body .= $search->display_form($edition_id); /* * Execute the query. */ try { $results = $client->search(array('q' => decode_entities($q), 'edition_id' => $edition_id, 'page' => $page, 'per_page' => $per_page)); } catch (Exception $error) { $error_message = 'Search failed with the error "' . $error->getMessage() . '". '; $error_message .= 'Please try again later.'; unset($results); } /* * If any portion of this search term appears to be misspelled, propose a properly spelled * version. */ if (isset($results) && $results->get_fixed_spelling() !== FALSE) { $body .= '<h1>Suggestions</h1>'; $suggested_q = $results->get_fixed_spelling(); $body .= '<p>Did you mean “<a href="/search/?' . $results->get_fixed_query() . '">' . $suggested_q . '</a>”?</p>'; } /*