fix some uses cases on settings

This commit is contained in:
qdequele 2020-01-28 17:45:29 +01:00
parent 5c49f08bb2
commit 50a9825a0f
No known key found for this signature in database
GPG key ID: B3F0A000EBF11745
5 changed files with 92 additions and 72 deletions

View file

@ -1,6 +1,7 @@
use chrono::{DateTime, Utc};
use log::error;
use meilisearch_core::ProcessedUpdateResult;
use meilisearch_schema::Schema;
use rand::seq::SliceRandom;
use serde::{Deserialize, Serialize};
use serde_json::json;
@ -94,6 +95,7 @@ pub async fn get_index(ctx: Request<Data>) -> SResult<Response> {
struct IndexCreateRequest {
name: Option<String>,
uid: Option<String>,
attribute_identifier: Option<String>,
}
#[derive(Debug, Serialize)]
@ -148,6 +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 {
created_index.main.put_schema(&mut writer, &Schema::with_identifier(id))?;
}
writer.commit()?;
let response_body = IndexCreateResponse {