mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Merge pull request #180 from shekhirin/disable-autogenerated-doc-ids
Disable autogenerate_docids by default
This commit is contained in:
commit
03bb95539b
@ -558,6 +558,7 @@ pub(crate) mod tests {
|
|||||||
{ "name": "bob", "age": 20 }
|
{ "name": "bob", "age": 20 }
|
||||||
]"#[..];
|
]"#[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Json);
|
builder.update_format(UpdateFormat::Json);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
|
@ -300,7 +300,7 @@ impl<'t, 'u, 'i, 'a> IndexDocuments<'t, 'u, 'i, 'a> {
|
|||||||
words_positions_min_level_size: None,
|
words_positions_min_level_size: None,
|
||||||
update_method: IndexDocumentsMethod::ReplaceDocuments,
|
update_method: IndexDocumentsMethod::ReplaceDocuments,
|
||||||
update_format: UpdateFormat::Json,
|
update_format: UpdateFormat::Json,
|
||||||
autogenerate_docids: true,
|
autogenerate_docids: false,
|
||||||
update_id,
|
update_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -901,7 +901,6 @@ mod tests {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let content = &b"name\nkevin\nkevina\nbenoit\n"[..];
|
let content = &b"name\nkevin\nkevina\nbenoit\n"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
builder.disable_autogenerate_docids();
|
|
||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
assert!(builder.execute(content, |_, _| ()).is_err());
|
assert!(builder.execute(content, |_, _| ()).is_err());
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
@ -928,7 +927,6 @@ mod tests {
|
|||||||
{ "name": "benoit" }
|
{ "name": "benoit" }
|
||||||
]"#[..];
|
]"#[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
builder.disable_autogenerate_docids();
|
|
||||||
builder.update_format(UpdateFormat::Json);
|
builder.update_format(UpdateFormat::Json);
|
||||||
assert!(builder.execute(content, |_, _| ()).is_err());
|
assert!(builder.execute(content, |_, _| ()).is_err());
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
@ -951,6 +949,7 @@ mod tests {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let content = &b"name\nkevin\nkevina\nbenoit\n"[..];
|
let content = &b"name\nkevin\nkevina\nbenoit\n"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
@ -1066,6 +1065,7 @@ mod tests {
|
|||||||
{ "name": "benoit" }
|
{ "name": "benoit" }
|
||||||
]"#[..];
|
]"#[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Json);
|
builder.update_format(UpdateFormat::Json);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
@ -1088,6 +1088,7 @@ mod tests {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let content = &b"[]"[..];
|
let content = &b"[]"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Json);
|
builder.update_format(UpdateFormat::Json);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
@ -1114,6 +1115,7 @@ mod tests {
|
|||||||
{ "name": "benoit" }
|
{ "name": "benoit" }
|
||||||
"#[..];
|
"#[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::JsonStream);
|
builder.update_format(UpdateFormat::JsonStream);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
|
@ -517,6 +517,7 @@ mod tests {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
@ -560,6 +561,7 @@ mod tests {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
@ -581,6 +583,7 @@ mod tests {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
|
|
||||||
@ -625,6 +628,7 @@ mod tests {
|
|||||||
// Then index some documents.
|
// Then index some documents.
|
||||||
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 1);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 1);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
@ -663,6 +667,7 @@ mod tests {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
let content = &b"name,age\nkevin,23\nkevina,21\nbenoit,34\n"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
@ -684,6 +689,7 @@ mod tests {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let content = &b"name,age,maxim\nkevin,23,I love dogs\nkevina,21,Doggos are the best\nbenoit,34,The crepes are really good\n"[..];
|
let content = &b"name,age,maxim\nkevin,23,I love dogs\nkevina,21,Doggos are the best\nbenoit,34,The crepes are really good\n"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
|
|
||||||
@ -754,6 +760,7 @@ mod tests {
|
|||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
let content = &b"name,age,maxim\nkevin,23,I love dogs\nkevina,21,Doggos are the best\nbenoit,34,The crepes are really good\n"[..];
|
let content = &b"name,age,maxim\nkevin,23,I love dogs\nkevina,21,Doggos are the best\nbenoit,34,The crepes are really good\n"[..];
|
||||||
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
|
||||||
|
builder.enable_autogenerate_docids();
|
||||||
builder.update_format(UpdateFormat::Csv);
|
builder.update_format(UpdateFormat::Csv);
|
||||||
builder.execute(content, |_, _| ()).unwrap();
|
builder.execute(content, |_, _| ()).unwrap();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user