mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Merge pull request #433 from meilisearch/fix-index-creation
Set the indexes info in the create_index function
This commit is contained in:
commit
2aa7cb9d20
@ -236,9 +236,13 @@ impl Database {
|
|||||||
let (sender, receiver) = crossbeam_channel::bounded(100);
|
let (sender, receiver) = crossbeam_channel::bounded(100);
|
||||||
let index = store::create(&self.env, &self.update_env, name, sender)?;
|
let index = store::create(&self.env, &self.update_env, name, sender)?;
|
||||||
|
|
||||||
let mut writer = self.env.write_txn()?;
|
let mut writer = self.env.typed_write_txn::<MainT>()?;
|
||||||
self.indexes_store.put(&mut writer, name, &())?;
|
self.indexes_store.put(&mut writer, name, &())?;
|
||||||
|
|
||||||
|
index.main.put_name(&mut writer, name)?;
|
||||||
|
index.main.put_created_at(&mut writer)?;
|
||||||
|
index.main.put_updated_at(&mut writer)?;
|
||||||
|
|
||||||
let env_clone = self.env.clone();
|
let env_clone = self.env.clone();
|
||||||
let update_env_clone = self.update_env.clone();
|
let update_env_clone = self.update_env.clone();
|
||||||
let index_clone = index.clone();
|
let index_clone = index.clone();
|
||||||
|
@ -57,13 +57,13 @@ pub async fn list_indexes(ctx: Context<Data>) -> SResult<Response> {
|
|||||||
.map_err(ResponseError::internal)?
|
.map_err(ResponseError::internal)?
|
||||||
.ok_or(ResponseError::internal("'updated_at' date not found"))?;
|
.ok_or(ResponseError::internal("'updated_at' date not found"))?;
|
||||||
|
|
||||||
let index_reponse = IndexResponse {
|
let index_response = IndexResponse {
|
||||||
name,
|
name,
|
||||||
uid: index_uid,
|
uid: index_uid,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at,
|
updated_at,
|
||||||
};
|
};
|
||||||
response_body.push(index_reponse);
|
response_body.push(index_response);
|
||||||
}
|
}
|
||||||
None => error!(
|
None => error!(
|
||||||
"Index {} is referenced in the indexes list but cannot be found",
|
"Index {} is referenced in the indexes list but cannot be found",
|
||||||
@ -171,14 +171,6 @@ pub async fn create_index(mut ctx: Context<Data>) -> SResult<Response> {
|
|||||||
.main
|
.main
|
||||||
.put_name(&mut writer, &body.name)
|
.put_name(&mut writer, &body.name)
|
||||||
.map_err(ResponseError::internal)?;
|
.map_err(ResponseError::internal)?;
|
||||||
created_index
|
|
||||||
.main
|
|
||||||
.put_created_at(&mut writer)
|
|
||||||
.map_err(ResponseError::internal)?;
|
|
||||||
created_index
|
|
||||||
.main
|
|
||||||
.put_updated_at(&mut writer)
|
|
||||||
.map_err(ResponseError::internal)?;
|
|
||||||
|
|
||||||
let schema: Option<Schema> = body.schema.clone().map(Into::into);
|
let schema: Option<Schema> = body.schema.clone().map(Into::into);
|
||||||
let mut response_update_id = None;
|
let mut response_update_id = None;
|
||||||
|
Loading…
Reference in New Issue
Block a user