mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
Update test
This commit is contained in:
parent
77d32d0ee8
commit
064158e4e2
@ -23,4 +23,3 @@ pub use self::roaring_bitmap_length::{
|
|||||||
pub use self::script_language_codec::ScriptLanguageCodec;
|
pub use self::script_language_codec::ScriptLanguageCodec;
|
||||||
pub use self::str_beu32_codec::StrBEU32Codec;
|
pub use self::str_beu32_codec::StrBEU32Codec;
|
||||||
pub use self::str_str_u8_codec::{U8StrStrCodec, UncheckedU8StrStrCodec};
|
pub use self::str_str_u8_codec::{U8StrStrCodec, UncheckedU8StrStrCodec};
|
||||||
pub use self::script_language_codec::ScriptLanguageCodec;
|
|
||||||
|
@ -19,8 +19,7 @@ use crate::heed_codec::facet::{
|
|||||||
FacetGroupKeyCodec, FacetGroupValueCodec, FieldDocIdFacetF64Codec, FieldDocIdFacetStringCodec,
|
FacetGroupKeyCodec, FacetGroupValueCodec, FieldDocIdFacetF64Codec, FieldDocIdFacetStringCodec,
|
||||||
FieldIdCodec, OrderedF64Codec,
|
FieldIdCodec, OrderedF64Codec,
|
||||||
};
|
};
|
||||||
use crate::heed_codec::StrRefCodec;
|
use crate::heed_codec::{ScriptLanguageCodec, StrRefCodec};
|
||||||
use crate::heed_codec::ScriptLanguageCodec;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
default_criteria, BEU32StrCodec, BoRoaringBitmapCodec, CboRoaringBitmapCodec, Criterion,
|
default_criteria, BEU32StrCodec, BoRoaringBitmapCodec, CboRoaringBitmapCodec, Criterion,
|
||||||
DocumentId, ExternalDocumentsIds, FacetDistribution, FieldDistribution, FieldId,
|
DocumentId, ExternalDocumentsIds, FacetDistribution, FieldDistribution, FieldId,
|
||||||
@ -154,7 +153,7 @@ impl Index {
|
|||||||
) -> Result<Index> {
|
) -> Result<Index> {
|
||||||
use db_name::*;
|
use db_name::*;
|
||||||
|
|
||||||
options.max_dbs(18);
|
options.max_dbs(19);
|
||||||
unsafe { options.flag(Flags::MdbAlwaysFreePages) };
|
unsafe { options.flag(Flags::MdbAlwaysFreePages) };
|
||||||
|
|
||||||
let env = options.open(path)?;
|
let env = options.open(path)?;
|
||||||
|
@ -1184,8 +1184,9 @@ mod tests {
|
|||||||
stats_should_not_return_deleted_documents_(DeletionStrategy::AlwaysSoft);
|
stats_should_not_return_deleted_documents_(DeletionStrategy::AlwaysSoft);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
fn stored_detected_script_and_language_should_not_return_deleted_documents_(
|
||||||
fn stored_detected_script_and_language_should_not_return_deleted_documents() {
|
deletion_strategy: DeletionStrategy,
|
||||||
|
) {
|
||||||
use charabia::{Language, Script};
|
use charabia::{Language, Script};
|
||||||
let index = TempIndex::new();
|
let index = TempIndex::new();
|
||||||
let mut wtxn = index.write_txn().unwrap();
|
let mut wtxn = index.write_txn().unwrap();
|
||||||
@ -1202,14 +1203,32 @@ mod tests {
|
|||||||
]))
|
]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
delete_documents(&mut wtxn, &index, &["1"]);
|
let key_cmn = (Script::Cj, Language::Cmn);
|
||||||
|
let cj_cmn_docs =
|
||||||
|
index.script_language_documents_ids(&wtxn, &key_cmn).unwrap().unwrap_or_default();
|
||||||
|
let mut expected_cj_cmn_docids = RoaringBitmap::new();
|
||||||
|
expected_cj_cmn_docids.push(1);
|
||||||
|
expected_cj_cmn_docids.push(5);
|
||||||
|
assert_eq!(cj_cmn_docs, expected_cj_cmn_docids);
|
||||||
|
|
||||||
|
delete_documents(&mut wtxn, &index, &["1"], deletion_strategy);
|
||||||
wtxn.commit().unwrap();
|
wtxn.commit().unwrap();
|
||||||
|
|
||||||
let rtxn = index.read_txn().unwrap();
|
let rtxn = index.read_txn().unwrap();
|
||||||
let key_cmn = (Script::Cj, Language::Cmn);
|
let cj_cmn_docs =
|
||||||
let cj_cmn_docs = index.script_language_documents_ids(&rtxn, &key_cmn).unwrap().unwrap();
|
index.script_language_documents_ids(&rtxn, &key_cmn).unwrap().unwrap_or_default();
|
||||||
let mut expected_cj_cmn_docids = RoaringBitmap::new();
|
let mut expected_cj_cmn_docids = RoaringBitmap::new();
|
||||||
expected_cj_cmn_docids.push(5);
|
expected_cj_cmn_docids.push(5);
|
||||||
assert_eq!(cj_cmn_docs, expected_cj_cmn_docids);
|
assert_eq!(cj_cmn_docs, expected_cj_cmn_docids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn stored_detected_script_and_language_should_not_return_deleted_documents() {
|
||||||
|
stored_detected_script_and_language_should_not_return_deleted_documents_(
|
||||||
|
DeletionStrategy::AlwaysHard,
|
||||||
|
);
|
||||||
|
stored_detected_script_and_language_should_not_return_deleted_documents_(
|
||||||
|
DeletionStrategy::AlwaysSoft,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user