Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinPostma authored and Kerollmops committed Jun 7, 2022
1 parent 05ae6db commit c1da3b9
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions milli/src/update/index_documents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1881,4 +1881,52 @@ mod tests {

wtxn.commit().unwrap();
}

#[test]
fn index_documents_in_multiple_transforms() {
let tmp = tempfile::tempdir().unwrap();
let mut options = EnvOpenOptions::new();
options.map_size(4096 * 100);
let index = Index::new(options, tmp).unwrap();
let mut wtxn = index.write_txn().unwrap();
let indexer_config = IndexerConfig::default();
let mut builder = IndexDocuments::new(
&mut wtxn,
&index,
&indexer_config,
IndexDocumentsConfig::default(),
|_| (),
)
.unwrap();

let doc1 = documents! {[{
"id": 228142,
"title": "asdsad",
"state": "automated",
"priority": "normal",
"public_uid": "37ccf021",
"project_id": 78207,
"branch_id_number": 0
}]};

let doc2 = documents! {[{
"id": 228143,
"title": "something",
"state": "automated",
"priority": "normal",
"public_uid": "39c6499b",
"project_id": 78207,
"branch_id_number": 0
}]};

builder.add_documents(doc1).unwrap();
builder.add_documents(doc2).unwrap();

builder.execute().unwrap();

let map = index.external_documents_ids(&wtxn).unwrap().to_hash_map();
let ids = map.values().collect::<HashSet<_>>();

assert_eq!(ids.len(), map.len());
}
}

0 comments on commit c1da3b9

Please sign in to comment.