mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
fix for review
This commit is contained in:
parent
14b5fc4d6c
commit
a5b0e468ee
48 changed files with 558 additions and 1216 deletions
|
@ -30,7 +30,7 @@ pub async fn get_document(ctx: Request<Data>) -> SResult<Response> {
|
|||
return Err(ResponseError::document_not_found(identifier));
|
||||
}
|
||||
|
||||
Ok(tide::Response::new(200).body_json(&response).unwrap())
|
||||
Ok(tide::Response::new(200).body_json(&response)?)
|
||||
}
|
||||
|
||||
#[derive(Default, Serialize)]
|
||||
|
@ -54,7 +54,7 @@ pub async fn delete_document(ctx: Request<Data>) -> SResult<Response> {
|
|||
update_writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize)]
|
||||
|
@ -106,7 +106,7 @@ pub async fn get_all_documents(ctx: Request<Data>) -> SResult<Response> {
|
|||
}
|
||||
}
|
||||
|
||||
Ok(tide::Response::new(200).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(200).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
fn find_identifier(document: &IndexMap<String, Value>) -> Option<String> {
|
||||
|
@ -146,10 +146,10 @@ async fn update_multiple_documents(mut ctx: Request<Data>, is_partial: bool) ->
|
|||
},
|
||||
};
|
||||
let settings = Settings {
|
||||
attribute_identifier: Some(Some(id)),
|
||||
identifier: Some(Some(id)),
|
||||
..Settings::default()
|
||||
};
|
||||
index.settings_update(&mut update_writer, settings.into())?;
|
||||
index.settings_update(&mut update_writer, settings.into_update()?)?;
|
||||
}
|
||||
|
||||
let mut document_addition = if is_partial {
|
||||
|
@ -166,7 +166,7 @@ async fn update_multiple_documents(mut ctx: Request<Data>, is_partial: bool) ->
|
|||
update_writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn add_or_replace_multiple_documents(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -200,7 +200,7 @@ pub async fn delete_multiple_documents(mut ctx: Request<Data>) -> SResult<Respon
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn clear_all_documents(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -215,5 +215,5 @@ pub async fn clear_all_documents(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ pub async fn list_indexes(ctx: Request<Data>) -> SResult<Response> {
|
|||
}
|
||||
}
|
||||
|
||||
Ok(tide::Response::new(200).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(200).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
|
@ -87,7 +87,7 @@ pub async fn get_index(ctx: Request<Data>) -> SResult<Response> {
|
|||
updated_at,
|
||||
};
|
||||
|
||||
Ok(tide::Response::new(200).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(200).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
@ -95,7 +95,7 @@ pub async fn get_index(ctx: Request<Data>) -> SResult<Response> {
|
|||
struct IndexCreateRequest {
|
||||
name: Option<String>,
|
||||
uid: Option<String>,
|
||||
attribute_identifier: Option<String>,
|
||||
identifier: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
|
@ -150,10 +150,10 @@ pub async fn create_index(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
.updated_at(&writer)?
|
||||
.into_internal_error()?;
|
||||
|
||||
if let Some(id) = body.attribute_identifier {
|
||||
if let Some(id) = body.identifier {
|
||||
created_index
|
||||
.main
|
||||
.put_schema(&mut writer, &Schema::with_identifier(id))?;
|
||||
.put_schema(&mut writer, &Schema::with_identifier(&id))?;
|
||||
}
|
||||
|
||||
writer.commit()?;
|
||||
|
@ -165,7 +165,7 @@ pub async fn create_index(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
updated_at,
|
||||
};
|
||||
|
||||
Ok(tide::Response::new(201).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(201).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
@ -214,7 +214,7 @@ pub async fn update_index(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
updated_at,
|
||||
};
|
||||
|
||||
Ok(tide::Response::new(200).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(200).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn get_update_status(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
|
|
@ -23,175 +23,131 @@ async fn into_response<T: IntoResponse, U: IntoResponse>(
|
|||
}
|
||||
|
||||
pub fn load_routes(app: &mut tide::Server<Data>) {
|
||||
app.at("").nest(|router| {
|
||||
// expose the web interface static files
|
||||
router.at("/").get(|_| {
|
||||
async move {
|
||||
let response = include_str!("../../public/interface.html");
|
||||
response
|
||||
}
|
||||
});
|
||||
router.at("/bulma.min.css").get(|_| {
|
||||
async {
|
||||
let response = include_str!("../../public/bulma.min.css");
|
||||
response
|
||||
}
|
||||
});
|
||||
|
||||
router.at("/indexes").nest(|router| {
|
||||
router
|
||||
.at("/")
|
||||
.get(|ctx| into_response(index::list_indexes(ctx)))
|
||||
.post(|ctx| into_response(index::create_index(ctx)));
|
||||
|
||||
router
|
||||
.at("/search")
|
||||
.post(|ctx| into_response(search::search_multi_index(ctx)));
|
||||
|
||||
router.at("/:index").nest(|router| {
|
||||
router
|
||||
.at("/search")
|
||||
.get(|ctx| into_response(search::search_with_url_query(ctx)));
|
||||
|
||||
router.at("/updates").nest(|router| {
|
||||
router
|
||||
.at("/")
|
||||
.get(|ctx| into_response(index::get_all_updates_status(ctx)));
|
||||
|
||||
router
|
||||
.at("/:update_id")
|
||||
.get(|ctx| into_response(index::get_update_status(ctx)));
|
||||
});
|
||||
|
||||
router
|
||||
.at("/")
|
||||
.get(|ctx| into_response(index::get_index(ctx)))
|
||||
.put(|ctx| into_response(index::update_index(ctx)))
|
||||
.delete(|ctx| into_response(index::delete_index(ctx)));
|
||||
|
||||
router.at("/documents").nest(|router| {
|
||||
router
|
||||
.at("/")
|
||||
.get(|ctx| into_response(document::get_all_documents(ctx)))
|
||||
.post(|ctx| into_response(document::add_or_replace_multiple_documents(ctx)))
|
||||
.put(|ctx| into_response(document::add_or_update_multiple_documents(ctx)))
|
||||
.delete(|ctx| into_response(document::clear_all_documents(ctx)));
|
||||
|
||||
router.at("/:identifier").nest(|router| {
|
||||
router
|
||||
.at("/")
|
||||
.get(|ctx| into_response(document::get_document(ctx)))
|
||||
.delete(|ctx| into_response(document::delete_document(ctx)));
|
||||
});
|
||||
|
||||
router
|
||||
.at("/delete-batch")
|
||||
.post(|ctx| into_response(document::delete_multiple_documents(ctx)));
|
||||
});
|
||||
|
||||
router.at("/settings").nest(|router| {
|
||||
router
|
||||
.get(|ctx| into_response(setting::get_all(ctx)))
|
||||
.post(|ctx| into_response(setting::update_all(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_all(ctx)));
|
||||
|
||||
router.at("/ranking").nest(|router| {
|
||||
router
|
||||
.get(|ctx| into_response(setting::get_ranking(ctx)))
|
||||
.post(|ctx| into_response(setting::update_ranking(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_ranking(ctx)));
|
||||
|
||||
router
|
||||
.at("/rules")
|
||||
.get(|ctx| into_response(setting::get_rules(ctx)))
|
||||
.post(|ctx| into_response(setting::update_rules(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_rules(ctx)));
|
||||
|
||||
router
|
||||
.at("/distinct")
|
||||
.get(|ctx| into_response(setting::get_distinct(ctx)))
|
||||
.post(|ctx| into_response(setting::update_distinct(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_distinct(ctx)));
|
||||
});
|
||||
|
||||
router.at("/attributes").nest(|router| {
|
||||
router
|
||||
.get(|ctx| into_response(setting::get_attributes(ctx)))
|
||||
.post(|ctx| into_response(setting::update_attributes(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_attributes(ctx)));
|
||||
|
||||
router
|
||||
.at("/identifier")
|
||||
.get(|ctx| into_response(setting::get_identifier(ctx)));
|
||||
|
||||
router
|
||||
.at("/searchable")
|
||||
.get(|ctx| into_response(setting::get_searchable(ctx)))
|
||||
.post(|ctx| into_response(setting::update_searchable(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_searchable(ctx)));
|
||||
|
||||
router
|
||||
.at("/displayed")
|
||||
.get(|ctx| into_response(setting::get_displayed(ctx)))
|
||||
.post(|ctx| into_response(setting::update_displayed(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_displayed(ctx)));
|
||||
});
|
||||
|
||||
router
|
||||
.at("/index-new-fields")
|
||||
.get(|ctx| into_response(setting::get_index_new_fields(ctx)))
|
||||
.post(|ctx| into_response(setting::update_index_new_fields(ctx)));
|
||||
|
||||
router
|
||||
.at("/synonyms")
|
||||
.get(|ctx| into_response(synonym::get(ctx)))
|
||||
.post(|ctx| into_response(synonym::update(ctx)))
|
||||
.delete(|ctx| into_response(synonym::delete(ctx)));
|
||||
|
||||
router
|
||||
.at("/stop-words")
|
||||
.get(|ctx| into_response(stop_words::get(ctx)))
|
||||
.post(|ctx| into_response(stop_words::update(ctx)))
|
||||
.delete(|ctx| into_response(stop_words::delete(ctx)));
|
||||
});
|
||||
|
||||
router
|
||||
.at("/stats")
|
||||
.get(|ctx| into_response(stats::index_stat(ctx)));
|
||||
});
|
||||
});
|
||||
|
||||
router.at("/keys").nest(|router| {
|
||||
router
|
||||
.at("/")
|
||||
.get(|ctx| into_response(key::list(ctx)))
|
||||
.post(|ctx| into_response(key::create(ctx)));
|
||||
|
||||
router
|
||||
.at("/:key")
|
||||
.get(|ctx| into_response(key::get(ctx)))
|
||||
.put(|ctx| into_response(key::update(ctx)))
|
||||
.delete(|ctx| into_response(key::delete(ctx)));
|
||||
});
|
||||
app.at("/").get(|_| {
|
||||
async move {
|
||||
tide::Response::new(200)
|
||||
.body_string(include_str!("../../public/interface.html").to_string())
|
||||
.set_mime(mime::TEXT_HTML_UTF_8)
|
||||
}
|
||||
});
|
||||
app.at("/bulma.min.css").get(|_| {
|
||||
async {
|
||||
tide::Response::new(200)
|
||||
.body_string(include_str!("../../public/bulma.min.css").to_string())
|
||||
.set_mime(mime::TEXT_CSS_UTF_8)
|
||||
}
|
||||
});
|
||||
|
||||
app.at("").nest(|router| {
|
||||
router
|
||||
.at("/health")
|
||||
.get(|ctx| into_response(health::get_health(ctx)))
|
||||
.put(|ctx| into_response(health::change_healthyness(ctx)));
|
||||
app.at("/indexes/")
|
||||
.get(|ctx| into_response(index::list_indexes(ctx)))
|
||||
.post(|ctx| into_response(index::create_index(ctx)));
|
||||
|
||||
router
|
||||
.at("/stats")
|
||||
.get(|ctx| into_response(stats::get_stats(ctx)));
|
||||
router
|
||||
.at("/version")
|
||||
.get(|ctx| into_response(stats::get_version(ctx)));
|
||||
router
|
||||
.at("/sys-info")
|
||||
.get(|ctx| into_response(stats::get_sys_info(ctx)));
|
||||
router
|
||||
.at("/sys-info/pretty")
|
||||
.get(|ctx| into_response(stats::get_sys_info_pretty(ctx)));
|
||||
});
|
||||
app.at("/indexes/search")
|
||||
.post(|ctx| into_response(search::search_multi_index(ctx)));
|
||||
|
||||
app.at("/indexes/:index")
|
||||
.get(|ctx| into_response(index::get_index(ctx)))
|
||||
.put(|ctx| into_response(index::update_index(ctx)))
|
||||
.delete(|ctx| into_response(index::delete_index(ctx)));
|
||||
|
||||
app.at("/indexes/:index/search")
|
||||
.get(|ctx| into_response(search::search_with_url_query(ctx)));
|
||||
|
||||
app.at("/indexes/:index/updates")
|
||||
.get(|ctx| into_response(index::get_all_updates_status(ctx)));
|
||||
|
||||
app.at("/indexes/:index/updates/:update_id")
|
||||
.get(|ctx| into_response(index::get_update_status(ctx)));
|
||||
|
||||
app.at("/indexes/:index/documents")
|
||||
.get(|ctx| into_response(document::get_all_documents(ctx)))
|
||||
.post(|ctx| into_response(document::add_or_replace_multiple_documents(ctx)))
|
||||
.put(|ctx| into_response(document::add_or_update_multiple_documents(ctx)))
|
||||
.delete(|ctx| into_response(document::clear_all_documents(ctx)));
|
||||
|
||||
app.at("/indexes/:index/documents/:identifier")
|
||||
.get(|ctx| into_response(document::get_document(ctx)))
|
||||
.delete(|ctx| into_response(document::delete_document(ctx)));
|
||||
|
||||
app.at("/indexes/:index/documents/:identifier/delete-batch")
|
||||
.post(|ctx| into_response(document::delete_multiple_documents(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings")
|
||||
.get(|ctx| into_response(setting::get_all(ctx)))
|
||||
.post(|ctx| into_response(setting::update_all(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_all(ctx)));
|
||||
app.at("/indexes/:index/settings/ranking")
|
||||
.get(|ctx| into_response(setting::get_ranking(ctx)))
|
||||
.post(|ctx| into_response(setting::update_ranking(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_ranking(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings/ranking/rules")
|
||||
.get(|ctx| into_response(setting::get_rules(ctx)))
|
||||
.post(|ctx| into_response(setting::update_rules(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_rules(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings/ranking/distinct")
|
||||
.get(|ctx| into_response(setting::get_distinct(ctx)))
|
||||
.post(|ctx| into_response(setting::update_distinct(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_distinct(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings/attributes")
|
||||
.get(|ctx| into_response(setting::get_attributes(ctx)))
|
||||
.post(|ctx| into_response(setting::update_attributes(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_attributes(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings/attributes/identifier")
|
||||
.get(|ctx| into_response(setting::get_identifier(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings/attributes/searchable")
|
||||
.get(|ctx| into_response(setting::get_searchable(ctx)))
|
||||
.post(|ctx| into_response(setting::update_searchable(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_searchable(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings/attributes/displayed")
|
||||
.get(|ctx| into_response(setting::displayed(ctx)))
|
||||
.post(|ctx| into_response(setting::update_displayed(ctx)))
|
||||
.delete(|ctx| into_response(setting::delete_displayed(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings/index-new-field")
|
||||
.get(|ctx| into_response(setting::get_index_new_fields(ctx)))
|
||||
.post(|ctx| into_response(setting::update_index_new_fields(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings/synonyms")
|
||||
.get(|ctx| into_response(synonym::get(ctx)))
|
||||
.post(|ctx| into_response(synonym::update(ctx)))
|
||||
.delete(|ctx| into_response(synonym::delete(ctx)));
|
||||
|
||||
app.at("/indexes/:index/settings/stop_words")
|
||||
.get(|ctx| into_response(stop_words::get(ctx)))
|
||||
.post(|ctx| into_response(stop_words::update(ctx)))
|
||||
.delete(|ctx| into_response(stop_words::delete(ctx)));
|
||||
|
||||
app.at("/indexes/:index/stats")
|
||||
.get(|ctx| into_response(stats::index_stat(ctx)));
|
||||
|
||||
app.at("/keys/")
|
||||
.get(|ctx| into_response(key::list(ctx)))
|
||||
.post(|ctx| into_response(key::create(ctx)));
|
||||
|
||||
app.at("/keys/:key")
|
||||
.get(|ctx| into_response(key::get(ctx)))
|
||||
.put(|ctx| into_response(key::update(ctx)))
|
||||
.delete(|ctx| into_response(key::delete(ctx)));
|
||||
|
||||
app.at("/health")
|
||||
.get(|ctx| into_response(health::get_health(ctx)))
|
||||
.put(|ctx| into_response(health::change_healthyness(ctx)));
|
||||
|
||||
app.at("/stats")
|
||||
.get(|ctx| into_response(stats::get_stats(ctx)));
|
||||
|
||||
app.at("/version")
|
||||
.get(|ctx| into_response(stats::get_version(ctx)));
|
||||
|
||||
app.at("/sys-info")
|
||||
.get(|ctx| into_response(stats::get_sys_info(ctx)));
|
||||
|
||||
app.at("/sys-info/pretty")
|
||||
.get(|ctx| into_response(stats::get_sys_info_pretty(ctx)));
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ pub async fn search_with_url_query(ctx: Request<Data>) -> SResult<Response> {
|
|||
let crop_length = query.crop_length.unwrap_or(200);
|
||||
if attributes_to_crop == "*" {
|
||||
let attributes_to_crop = schema
|
||||
.get_displayed_name()
|
||||
.displayed_name()
|
||||
.iter()
|
||||
.map(|attr| (attr.to_string(), crop_length))
|
||||
.collect();
|
||||
|
@ -78,11 +78,15 @@ pub async fn search_with_url_query(ctx: Request<Data>) -> SResult<Response> {
|
|||
|
||||
if let Some(attributes_to_highlight) = query.attributes_to_highlight {
|
||||
let attributes_to_highlight = if attributes_to_highlight == "*" {
|
||||
schema.get_displayed_name()
|
||||
schema
|
||||
.displayed_name()
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect()
|
||||
} else {
|
||||
attributes_to_highlight
|
||||
.split(',')
|
||||
.map(ToString::to_string)
|
||||
.map(|s| s.to_string())
|
||||
.collect()
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ pub async fn get_all(ctx: Request<Data>) -> SResult<Response> {
|
|||
let stop_words_fst = index.main.stop_words_fst(&reader)?;
|
||||
let stop_words = stop_words_fst.unwrap_or_default().stream().into_strs()?;
|
||||
let stop_words: BTreeSet<String> = stop_words.into_iter().collect();
|
||||
let stop_words = if stop_words.len() > 0 {
|
||||
let stop_words = if stop_words.is_empty() {
|
||||
Some(stop_words)
|
||||
} else {
|
||||
None
|
||||
|
@ -40,7 +40,7 @@ pub async fn get_all(ctx: Request<Data>) -> SResult<Response> {
|
|||
}
|
||||
}
|
||||
|
||||
let synonyms = if synonyms.len() > 0 {
|
||||
let synonyms = if synonyms.is_empty() {
|
||||
Some(synonyms)
|
||||
} else {
|
||||
None
|
||||
|
@ -54,17 +54,21 @@ pub async fn get_all(ctx: Request<Data>) -> SResult<Response> {
|
|||
|
||||
let schema = index.main.schema(&reader)?;
|
||||
|
||||
let attribute_identifier = schema.clone().map(|s| s.identifier());
|
||||
let attributes_searchable = schema.clone().map(|s| s.get_indexed_name());
|
||||
let attributes_displayed = schema.clone().map(|s| s.get_displayed_name());
|
||||
let index_new_fields = schema.map(|s| s.must_index_new_fields());
|
||||
let identifier = schema.clone().map(|s| s.identifier().to_owned());
|
||||
let searchable_attributes = schema
|
||||
.clone()
|
||||
.map(|s| s.indexed_name().iter().map(|s| s.to_string()).collect());
|
||||
let displayed_attributes = schema
|
||||
.clone()
|
||||
.map(|s| s.displayed_name().iter().map(|s| s.to_string()).collect());
|
||||
let index_new_fields = schema.map(|s| s.index_new_fields());
|
||||
|
||||
let settings = Settings {
|
||||
ranking_rules: Some(ranking_rules),
|
||||
ranking_distinct: Some(ranking_distinct),
|
||||
attribute_identifier: Some(attribute_identifier),
|
||||
attributes_searchable: Some(attributes_searchable),
|
||||
attributes_displayed: Some(attributes_displayed),
|
||||
identifier: Some(identifier),
|
||||
searchable_attributes: Some(searchable_attributes),
|
||||
displayed_attributes: Some(displayed_attributes),
|
||||
stop_words: Some(stop_words),
|
||||
synonyms: Some(synonyms),
|
||||
index_new_fields: Some(index_new_fields),
|
||||
|
@ -78,9 +82,9 @@ pub async fn get_all(ctx: Request<Data>) -> SResult<Response> {
|
|||
pub struct UpdateSettings {
|
||||
pub ranking_rules: Option<Vec<String>>,
|
||||
pub ranking_distinct: Option<String>,
|
||||
pub attribute_identifier: Option<String>,
|
||||
pub attributes_searchable: Option<Vec<String>>,
|
||||
pub attributes_displayed: Option<HashSet<String>>,
|
||||
pub identifier: Option<String>,
|
||||
pub searchable_attributes: Option<Vec<String>>,
|
||||
pub displayed_attributes: Option<HashSet<String>>,
|
||||
pub stop_words: Option<BTreeSet<String>>,
|
||||
pub synonyms: Option<BTreeMap<String, Vec<String>>>,
|
||||
pub index_new_fields: Option<bool>,
|
||||
|
@ -96,20 +100,20 @@ pub async fn update_all(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
let settings = Settings {
|
||||
ranking_rules: Some(settings_update.ranking_rules),
|
||||
ranking_distinct: Some(settings_update.ranking_distinct),
|
||||
attribute_identifier: Some(settings_update.attribute_identifier),
|
||||
attributes_searchable: Some(settings_update.attributes_searchable),
|
||||
attributes_displayed: Some(settings_update.attributes_displayed),
|
||||
identifier: Some(settings_update.identifier),
|
||||
searchable_attributes: Some(settings_update.searchable_attributes),
|
||||
displayed_attributes: Some(settings_update.displayed_attributes),
|
||||
stop_words: Some(settings_update.stop_words),
|
||||
synonyms: Some(settings_update.synonyms),
|
||||
index_new_fields: Some(settings_update.index_new_fields),
|
||||
};
|
||||
|
||||
let mut writer = db.update_write_txn()?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into())?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into_update()?)?;
|
||||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn delete_all(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -121,9 +125,9 @@ pub async fn delete_all(ctx: Request<Data>) -> SResult<Response> {
|
|||
let settings = SettingsUpdate {
|
||||
ranking_rules: UpdateState::Clear,
|
||||
ranking_distinct: UpdateState::Clear,
|
||||
attribute_identifier: UpdateState::Clear,
|
||||
attributes_searchable: UpdateState::Clear,
|
||||
attributes_displayed: UpdateState::Clear,
|
||||
identifier: UpdateState::Clear,
|
||||
searchable_attributes: UpdateState::Clear,
|
||||
displayed_attributes: UpdateState::Clear,
|
||||
stop_words: UpdateState::Clear,
|
||||
synonyms: UpdateState::Clear,
|
||||
index_new_fields: UpdateState::Clear,
|
||||
|
@ -134,12 +138,12 @@ pub async fn delete_all(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct GetRankingSettings {
|
||||
pub struct RankingSettings {
|
||||
pub ranking_rules: Option<Vec<String>>,
|
||||
pub ranking_distinct: Option<String>,
|
||||
}
|
||||
|
@ -156,7 +160,7 @@ pub async fn get_ranking(ctx: Request<Data>) -> SResult<Response> {
|
|||
};
|
||||
|
||||
let ranking_distinct = index.main.ranking_distinct(&reader)?;
|
||||
let settings = GetRankingSettings {
|
||||
let settings = RankingSettings {
|
||||
ranking_rules,
|
||||
ranking_distinct,
|
||||
};
|
||||
|
@ -164,17 +168,10 @@ pub async fn get_ranking(ctx: Request<Data>) -> SResult<Response> {
|
|||
Ok(tide::Response::new(200).body_json(&settings).unwrap())
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct SetRankingSettings {
|
||||
pub ranking_rules: Option<Vec<String>>,
|
||||
pub ranking_distinct: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn update_ranking(mut ctx: Request<Data>) -> SResult<Response> {
|
||||
ctx.is_allowed(SettingsWrite)?;
|
||||
let index = ctx.index()?;
|
||||
let settings: SetRankingSettings = ctx.body_json().await.map_err(ResponseError::bad_request)?;
|
||||
let settings: RankingSettings = ctx.body_json().await.map_err(ResponseError::bad_request)?;
|
||||
let db = &ctx.state().db;
|
||||
|
||||
let settings = Settings {
|
||||
|
@ -184,11 +181,11 @@ pub async fn update_ranking(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
};
|
||||
|
||||
let mut writer = db.update_write_txn()?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into())?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into_update()?)?;
|
||||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn delete_ranking(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -208,7 +205,7 @@ pub async fn delete_ranking(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn get_rules(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -238,11 +235,11 @@ pub async fn update_rules(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
};
|
||||
|
||||
let mut writer = db.update_write_txn()?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into())?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into_update()?)?;
|
||||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn delete_rules(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -261,13 +258,7 @@ pub async fn delete_rules(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct GetRankingDistinctSettings {
|
||||
pub ranking_distinct: Option<String>,
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn get_distinct(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -283,12 +274,6 @@ pub async fn get_distinct(ctx: Request<Data>) -> SResult<Response> {
|
|||
.unwrap())
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct SetRankingDistinctSettings {
|
||||
pub ranking_distinct: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn update_distinct(mut ctx: Request<Data>) -> SResult<Response> {
|
||||
ctx.is_allowed(SettingsWrite)?;
|
||||
let index = ctx.index()?;
|
||||
|
@ -302,11 +287,11 @@ pub async fn update_distinct(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
};
|
||||
|
||||
let mut writer = db.update_write_txn()?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into())?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into_update()?)?;
|
||||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn delete_distinct(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -325,15 +310,15 @@ pub async fn delete_distinct(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct GetAttributesSettings {
|
||||
pub attribute_identifier: Option<String>,
|
||||
pub attributes_searchable: Option<Vec<String>>,
|
||||
pub attributes_displayed: Option<HashSet<String>>,
|
||||
pub struct AttributesSettings {
|
||||
pub identifier: Option<String>,
|
||||
pub searchable_attributes: Option<Vec<String>>,
|
||||
pub displayed_attributes: Option<HashSet<String>>,
|
||||
}
|
||||
|
||||
pub async fn get_attributes(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -344,47 +329,42 @@ pub async fn get_attributes(ctx: Request<Data>) -> SResult<Response> {
|
|||
|
||||
let schema = index.main.schema(&reader)?;
|
||||
|
||||
let attribute_identifier = schema.clone().map(|s| s.identifier());
|
||||
let attributes_searchable = schema.clone().map(|s| s.get_indexed_name());
|
||||
let attributes_displayed = schema.clone().map(|s| s.get_displayed_name());
|
||||
let identifier = schema.clone().map(|s| s.identifier().to_string());
|
||||
let searchable_attributes = schema
|
||||
.clone()
|
||||
.map(|s| s.indexed_name().iter().map(|s| s.to_string()).collect());
|
||||
let displayed_attributes = schema
|
||||
.clone()
|
||||
.map(|s| s.displayed_name().iter().map(|s| s.to_string()).collect());
|
||||
|
||||
let settings = GetAttributesSettings {
|
||||
attribute_identifier,
|
||||
attributes_searchable,
|
||||
attributes_displayed,
|
||||
let settings = AttributesSettings {
|
||||
identifier,
|
||||
searchable_attributes,
|
||||
displayed_attributes,
|
||||
};
|
||||
|
||||
Ok(tide::Response::new(200).body_json(&settings).unwrap())
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct SetAttributesSettings {
|
||||
pub attribute_identifier: Option<String>,
|
||||
pub attributes_searchable: Option<Vec<String>>,
|
||||
pub attributes_displayed: Option<HashSet<String>>,
|
||||
}
|
||||
|
||||
pub async fn update_attributes(mut ctx: Request<Data>) -> SResult<Response> {
|
||||
ctx.is_allowed(SettingsWrite)?;
|
||||
let index = ctx.index()?;
|
||||
let settings: SetAttributesSettings =
|
||||
ctx.body_json().await.map_err(ResponseError::bad_request)?;
|
||||
let settings: AttributesSettings = ctx.body_json().await.map_err(ResponseError::bad_request)?;
|
||||
let db = &ctx.state().db;
|
||||
|
||||
let settings = Settings {
|
||||
attribute_identifier: Some(settings.attribute_identifier),
|
||||
attributes_searchable: Some(settings.attributes_searchable),
|
||||
attributes_displayed: Some(settings.attributes_displayed),
|
||||
identifier: Some(settings.identifier),
|
||||
searchable_attributes: Some(settings.searchable_attributes),
|
||||
displayed_attributes: Some(settings.displayed_attributes),
|
||||
..Settings::default()
|
||||
};
|
||||
|
||||
let mut writer = db.update_write_txn()?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into())?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into_update()?)?;
|
||||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn delete_attributes(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -393,8 +373,8 @@ pub async fn delete_attributes(ctx: Request<Data>) -> SResult<Response> {
|
|||
let db = &ctx.state().db;
|
||||
|
||||
let settings = SettingsUpdate {
|
||||
attributes_searchable: UpdateState::Clear,
|
||||
attributes_displayed: UpdateState::Clear,
|
||||
searchable_attributes: UpdateState::Clear,
|
||||
displayed_attributes: UpdateState::Clear,
|
||||
..SettingsUpdate::default()
|
||||
};
|
||||
|
||||
|
@ -403,7 +383,7 @@ pub async fn delete_attributes(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn get_identifier(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -414,11 +394,9 @@ pub async fn get_identifier(ctx: Request<Data>) -> SResult<Response> {
|
|||
|
||||
let schema = index.main.schema(&reader)?;
|
||||
|
||||
let attribute_identifier = schema.map(|s| s.identifier());
|
||||
let identifier = schema.map(|s| s.identifier().to_string());
|
||||
|
||||
Ok(tide::Response::new(200)
|
||||
.body_json(&attribute_identifier)
|
||||
.unwrap())
|
||||
Ok(tide::Response::new(200).body_json(&identifier).unwrap())
|
||||
}
|
||||
|
||||
pub async fn get_searchable(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -429,37 +407,32 @@ pub async fn get_searchable(ctx: Request<Data>) -> SResult<Response> {
|
|||
|
||||
let schema = index.main.schema(&reader)?;
|
||||
|
||||
let attributes_searchable = schema.map(|s| s.get_indexed_name());
|
||||
let searchable_attributes: Option<HashSet<String>> =
|
||||
schema.map(|s| s.indexed_name().iter().map(|i| i.to_string()).collect());
|
||||
|
||||
Ok(tide::Response::new(200)
|
||||
.body_json(&attributes_searchable)
|
||||
.body_json(&searchable_attributes)
|
||||
.unwrap())
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct SetAttributesSearchableSettings {
|
||||
pub attributes_searchable: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
pub async fn update_searchable(mut ctx: Request<Data>) -> SResult<Response> {
|
||||
ctx.is_allowed(SettingsWrite)?;
|
||||
let index = ctx.index()?;
|
||||
let attributes_searchable: Option<Vec<String>> =
|
||||
let searchable_attributes: Option<Vec<String>> =
|
||||
ctx.body_json().await.map_err(ResponseError::bad_request)?;
|
||||
let db = &ctx.state().db;
|
||||
|
||||
let settings = Settings {
|
||||
attributes_searchable: Some(attributes_searchable),
|
||||
searchable_attributes: Some(searchable_attributes),
|
||||
..Settings::default()
|
||||
};
|
||||
|
||||
let mut writer = db.update_write_txn()?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into())?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into_update()?)?;
|
||||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn delete_searchable(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -468,7 +441,7 @@ pub async fn delete_searchable(ctx: Request<Data>) -> SResult<Response> {
|
|||
let db = &ctx.state().db;
|
||||
|
||||
let settings = SettingsUpdate {
|
||||
attributes_searchable: UpdateState::Clear,
|
||||
searchable_attributes: UpdateState::Clear,
|
||||
..SettingsUpdate::default()
|
||||
};
|
||||
|
||||
|
@ -477,10 +450,10 @@ pub async fn delete_searchable(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn get_displayed(ctx: Request<Data>) -> SResult<Response> {
|
||||
pub async fn displayed(ctx: Request<Data>) -> SResult<Response> {
|
||||
ctx.is_allowed(SettingsRead)?;
|
||||
let index = ctx.index()?;
|
||||
let db = &ctx.state().db;
|
||||
|
@ -488,31 +461,32 @@ pub async fn get_displayed(ctx: Request<Data>) -> SResult<Response> {
|
|||
|
||||
let schema = index.main.schema(&reader)?;
|
||||
|
||||
let attributes_displayed = schema.map(|s| s.get_displayed_name());
|
||||
let displayed_attributes: Option<HashSet<String>> =
|
||||
schema.map(|s| s.displayed_name().iter().map(|i| i.to_string()).collect());
|
||||
|
||||
Ok(tide::Response::new(200)
|
||||
.body_json(&attributes_displayed)
|
||||
.body_json(&displayed_attributes)
|
||||
.unwrap())
|
||||
}
|
||||
|
||||
pub async fn update_displayed(mut ctx: Request<Data>) -> SResult<Response> {
|
||||
ctx.is_allowed(SettingsWrite)?;
|
||||
let index = ctx.index()?;
|
||||
let attributes_displayed: Option<HashSet<String>> =
|
||||
let displayed_attributes: Option<HashSet<String>> =
|
||||
ctx.body_json().await.map_err(ResponseError::bad_request)?;
|
||||
let db = &ctx.state().db;
|
||||
|
||||
let settings = Settings {
|
||||
attributes_displayed: Some(attributes_displayed),
|
||||
displayed_attributes: Some(displayed_attributes),
|
||||
..Settings::default()
|
||||
};
|
||||
|
||||
let mut writer = db.update_write_txn()?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into())?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into_update()?)?;
|
||||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn delete_displayed(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -521,7 +495,7 @@ pub async fn delete_displayed(ctx: Request<Data>) -> SResult<Response> {
|
|||
let db = &ctx.state().db;
|
||||
|
||||
let settings = SettingsUpdate {
|
||||
attributes_displayed: UpdateState::Clear,
|
||||
displayed_attributes: UpdateState::Clear,
|
||||
..SettingsUpdate::default()
|
||||
};
|
||||
|
||||
|
@ -530,7 +504,7 @@ pub async fn delete_displayed(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn get_index_new_fields(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -541,7 +515,7 @@ pub async fn get_index_new_fields(ctx: Request<Data>) -> SResult<Response> {
|
|||
|
||||
let schema = index.main.schema(&reader)?;
|
||||
|
||||
let index_new_fields = schema.map(|s| s.must_index_new_fields());
|
||||
let index_new_fields = schema.map(|s| s.index_new_fields());
|
||||
|
||||
Ok(tide::Response::new(200)
|
||||
.body_json(&index_new_fields)
|
||||
|
@ -561,9 +535,9 @@ pub async fn update_index_new_fields(mut ctx: Request<Data>) -> SResult<Response
|
|||
};
|
||||
|
||||
let mut writer = db.update_write_txn()?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into())?;
|
||||
let update_id = index.settings_update(&mut writer, settings.into_update()?)?;
|
||||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ pub async fn update(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn delete(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -59,5 +59,5 @@ pub async fn delete(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ pub async fn update(mut ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
||||
pub async fn delete(ctx: Request<Data>) -> SResult<Response> {
|
||||
|
@ -78,5 +78,5 @@ pub async fn delete(ctx: Request<Data>) -> SResult<Response> {
|
|||
writer.commit()?;
|
||||
|
||||
let response_body = IndexUpdateResponse { update_id };
|
||||
Ok(tide::Response::new(202).body_json(&response_body).unwrap())
|
||||
Ok(tide::Response::new(202).body_json(&response_body)?)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue