feat: Introduce the update_status/_blocking functions

This commit is contained in:
Clément Renault
2019-08-23 14:53:31 +02:00
committed by Clément Renault
parent f07b99fe97
commit cd8535d410
2 changed files with 45 additions and 16 deletions

View File

@ -22,10 +22,8 @@ fn insert_delete_document() {
let mut addition = index.documents_addition();
addition.update_document(&doc1);
let update_id = addition.finalize().unwrap();
println!("addition update id: {}", update_id);
// TODO remove this and create a waitable function
std::thread::sleep(std::time::Duration::from_millis(100));
let status = index.update_status_blocking(update_id).unwrap();
assert_eq!(status, Ok(()));
let docs = index.query_builder().query("hello", 0..10).unwrap();
assert_eq!(docs.len(), 1);
@ -34,10 +32,8 @@ fn insert_delete_document() {
let mut deletion = index.documents_deletion();
deletion.delete_document(&doc1).unwrap();
let update_id = deletion.finalize().unwrap();
println!("deletion update id: {}", update_id);
// TODO remove this and create a waitable function
std::thread::sleep(std::time::Duration::from_millis(100));
let status = index.update_status_blocking(update_id).unwrap();
assert_eq!(status, Ok(()));
let docs = index.query_builder().query("hello", 0..10).unwrap();
assert_eq!(docs.len(), 0);
@ -57,10 +53,8 @@ fn replace_document() {
let mut addition = index.documents_addition();
addition.update_document(&doc1);
let update_id = addition.finalize().unwrap();
println!("addition update id: {}", update_id);
// TODO remove this and create a waitable function
std::thread::sleep(std::time::Duration::from_millis(100));
let status = index.update_status_blocking(update_id).unwrap();
assert_eq!(status, Ok(()));
let docs = index.query_builder().query("hello", 0..10).unwrap();
assert_eq!(docs.len(), 1);
@ -69,10 +63,8 @@ fn replace_document() {
let mut deletion = index.documents_addition();
deletion.update_document(&doc2);
let update_id = deletion.finalize().unwrap();
println!("deletion update id: {}", update_id);
// TODO remove this and create a waitable function
std::thread::sleep(std::time::Duration::from_millis(100));
let status = index.update_status_blocking(update_id).unwrap();
assert_eq!(status, Ok(()));
let docs = index.query_builder().query("hello", 0..10).unwrap();
assert_eq!(docs.len(), 0);