You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: search.rs
    path of file: ./repos/Plume/src/routes
    
    the code of the file until where you have to start completion: use chrono::offset::Utc;
use rocket::request::Form;

use crate::routes::Page;
use crate::template_utils::{IntoContext, Ructe};
use plume_models::{db_conn::DbConn, search::Query, PlumeRocket};
use std::str::F
    
pub fn search(query: Option<Form<SearchQuery>>, conn: DbConn, rockets: PlumeRocket) -> Ructe {
    let query = query.map(Form::into_inner).unwrap_or_default();
    let page = query.page.unwrap_or_default();
    let mut parsed_query =
        Query::from_str(query.q.as_deref().unwrap_or_default()).unwrap_or_default();

    param_to_query!(query, parsed_query; normal: title, subtitle, content, tag,
              instance, author, blog, lang, license;
              date: before, after);

    let str_query = parsed_query.to_string();

    if str_query.is_empty() {
        render!(search::index(
            &(&conn, &rockets).to_context(),
            &format!("{}", Utc::now().date_naive().format("%Y-%m-d"))
        ))
    } else {
        let res = rockets
            .searcher
            .search_document(&conn, parsed_query, page.limits());
        let next_page = if res.is_empty() { 0 } else { page.0 + 1 };
        render!(search::result(
            &(&conn, &rockets).to_context(),
            &str_query,
            res,
            page.0,
            next_page
        ))
    }
}