implement search and fix document addition

This commit is contained in:
mpostma
2021-02-27 10:19:05 +01:00
parent 658166c05e
commit c4dfd5f0c3
9 changed files with 842 additions and 33 deletions

View File

@ -83,7 +83,7 @@ async fn search_with_url_query(
return Ok(HttpResponse::BadRequest().body(serde_json::json!({ "error": e.to_string() })))
}
};
let search_result = data.search(&path.index_uid, query);
let search_result = data.search(&path.index_uid, query).await;
match search_result {
Ok(docs) => {
let docs = serde_json::to_string(&docs).unwrap();
@ -101,7 +101,7 @@ async fn search_with_post(
path: web::Path<IndexParam>,
params: web::Json<SearchQuery>,
) -> Result<HttpResponse, ResponseError> {
let search_result = data.search(&path.index_uid, params.into_inner());
let search_result = data.search(&path.index_uid, params.into_inner()).await;
match search_result {
Ok(docs) => {
let docs = serde_json::to_string(&docs).unwrap();