feat: Change the query name to 'q'

This commit is contained in:
Clément Renault 2018-09-21 22:37:43 +02:00
parent c99ba88288
commit d2fb2ff404

View File

@ -30,7 +30,7 @@ struct Opt {
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct SearchQuery { query: String } struct SearchQuery { q: String }
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
struct Document<'a> { struct Document<'a> {
@ -120,7 +120,7 @@ fn main() {
let routes = warp::path("search") let routes = warp::path("search")
.and(warp::query()) .and(warp::query())
.map(move |query: SearchQuery| { .map(move |query: SearchQuery| {
let body = search(meta.clone(), db.clone(), &common_words, &query.query).unwrap(); let body = search(meta.clone(), db.clone(), &common_words, &query.q).unwrap();
body body
}) })
.with(warp::reply::with::header("Content-Type", "application/json")) .with(warp::reply::with::header("Content-Type", "application/json"))