Add tests for checking that detected script and language associated with document(s) were stored during indexing

This commit is contained in:
f3r10 2022-10-14 14:05:53 -05:00 committed by ManyTheFish
parent b216ddba63
commit a27f329e3a
2 changed files with 42 additions and 0 deletions

View file

@ -4,6 +4,7 @@ use std::fs::File;
use std::mem::size_of;
use std::path::Path;
use charabia::{Language, Script};
use heed::flags::Flags;
use heed::types::*;
use heed::{CompactionOption, Database, PolyDatabase, RoTxn, RwTxn};
@ -1194,6 +1195,12 @@ impl Index {
pub(crate) fn delete_pagination_max_total_hits(&self, txn: &mut RwTxn) -> heed::Result<bool> {
self.main.delete::<_, Str>(txn, main_key::PAGINATION_MAX_TOTAL_HITS)
}
/* script language docids */
/// Retrieve all the documents ids that correspond with (Script, Language) key, `None` if it is any.
pub fn script_language_documents_ids(&self, rtxn: &RoTxn, key: &(Script, Language)) -> heed::Result<Option<RoaringBitmap>> {
self.script_language_docids.get(rtxn, key)
}
}
#[cfg(test)]