mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Use the new ExternalDocumentsIds struct in the engine
This commit is contained in:
parent
fe82516f9f
commit
27f3ef5f7a
5 changed files with 32 additions and 58 deletions
20
src/index.rs
20
src/index.rs
|
@ -7,11 +7,10 @@ use heed::types::*;
|
|||
use heed::{PolyDatabase, Database, RwTxn, RoTxn};
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
use crate::external_documents_ids::ExternalDocumentsIds;
|
||||
use crate::facet::FacetType;
|
||||
use crate::fields_ids_map::FieldsIdsMap;
|
||||
use crate::Search;
|
||||
use crate::{BEU32, DocumentId};
|
||||
use crate::{BEU32, DocumentId, ExternalDocumentsIds};
|
||||
use crate::{
|
||||
RoaringBitmapCodec, BEU32StrCodec, StrStrU8Codec, ObkvCodec,
|
||||
BoRoaringBitmapCodec, CboRoaringBitmapCodec,
|
||||
|
@ -143,14 +142,15 @@ impl Index {
|
|||
pub fn external_documents_ids<'t>(&self, rtxn: &'t RoTxn) -> anyhow::Result<ExternalDocumentsIds<'t>> {
|
||||
let hard = self.main.get::<_, Str, ByteSlice>(rtxn, HARD_EXTERNAL_DOCUMENTS_IDS_KEY)?;
|
||||
let soft = self.main.get::<_, Str, ByteSlice>(rtxn, SOFT_EXTERNAL_DOCUMENTS_IDS_KEY)?;
|
||||
match hard.zip(soft) {
|
||||
Some((hard, soft)) => {
|
||||
let hard = fst::Map::new(hard)?.map_data(Cow::Borrowed)?;
|
||||
let soft = fst::Map::new(soft)?.map_data(Cow::Borrowed)?;
|
||||
Ok(ExternalDocumentsIds::new(hard, soft))
|
||||
},
|
||||
None => Ok(ExternalDocumentsIds::default()),
|
||||
}
|
||||
let hard = match hard {
|
||||
Some(hard) => fst::Map::new(hard)?.map_data(Cow::Borrowed)?,
|
||||
None => fst::Map::default().map_data(Cow::Owned)?,
|
||||
};
|
||||
let soft = match soft {
|
||||
Some(soft) => fst::Map::new(soft)?.map_data(Cow::Borrowed)?,
|
||||
None => fst::Map::default().map_data(Cow::Owned)?,
|
||||
};
|
||||
Ok(ExternalDocumentsIds::new(hard, soft))
|
||||
}
|
||||
|
||||
/* fields ids map */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue