mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
review the internal schema to allow to create schema without identifier; fix #513
This commit is contained in:
parent
16a99aa95e
commit
86c3482cbd
11 changed files with 312 additions and 129 deletions
|
@ -8,6 +8,7 @@ use crossbeam_channel::{Receiver, Sender};
|
|||
use heed::types::{Str, Unit};
|
||||
use heed::{CompactionOption, Result as ZResult};
|
||||
use log::debug;
|
||||
use meilisearch_schema::Schema;
|
||||
|
||||
use crate::{store, update, Index, MResult};
|
||||
|
||||
|
@ -242,6 +243,7 @@ impl Database {
|
|||
index.main.put_name(&mut writer, name)?;
|
||||
index.main.put_created_at(&mut writer)?;
|
||||
index.main.put_updated_at(&mut writer)?;
|
||||
index.main.put_schema(&mut writer, &Schema::new())?;
|
||||
|
||||
let env_clone = self.env.clone();
|
||||
let update_env_clone = self.update_env.clone();
|
||||
|
|
|
@ -115,7 +115,7 @@ pub fn apply_documents_addition<'a, 'b>(
|
|||
None => return Err(Error::SchemaMissing),
|
||||
};
|
||||
|
||||
let identifier = schema.identifier();
|
||||
let identifier = schema.identifier().ok_or(Error::MissingIdentifier)?;
|
||||
|
||||
// 1. store documents ids for future deletion
|
||||
for document in addition {
|
||||
|
@ -184,7 +184,7 @@ pub fn apply_documents_partial_addition<'a, 'b>(
|
|||
None => return Err(Error::SchemaMissing),
|
||||
};
|
||||
|
||||
let identifier = schema.identifier();
|
||||
let identifier = schema.identifier().ok_or(Error::MissingIdentifier)?;
|
||||
|
||||
// 1. store documents ids for future deletion
|
||||
for mut document in addition {
|
||||
|
|
|
@ -40,7 +40,7 @@ impl DocumentsDeletion {
|
|||
where
|
||||
D: serde::Serialize,
|
||||
{
|
||||
let identifier = schema.identifier();
|
||||
let identifier = schema.identifier().ok_or(Error::MissingIdentifier)?;
|
||||
let document_id = match extract_document_id(&identifier, &document)? {
|
||||
Some(id) => id,
|
||||
None => return Err(Error::MissingDocumentId),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue