From bf0651f23cdb7decc9b3c7fe31dbc9fc21e429be Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Thu, 2 Nov 2023 15:37:05 +0100 Subject: [PATCH] Implement iter method on ExternalDocumentsIds --- milli/src/external_documents_ids.rs | 7 ++++++- milli/src/update/index_documents/transform.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/milli/src/external_documents_ids.rs b/milli/src/external_documents_ids.rs index a002fc064..e0a71b7cd 100644 --- a/milli/src/external_documents_ids.rs +++ b/milli/src/external_documents_ids.rs @@ -18,7 +18,7 @@ pub struct DocumentOperation { pub kind: DocumentOperationKind, } -pub struct ExternalDocumentsIds(pub Database>); +pub struct ExternalDocumentsIds(Database>); impl ExternalDocumentsIds { pub fn new(db: Database>) -> ExternalDocumentsIds { @@ -86,6 +86,11 @@ impl ExternalDocumentsIds { Ok(()) } + + /// Returns an iterator over all the external ids. + pub fn iter<'t>(&self, rtxn: &'t RoTxn) -> heed::Result>> { + self.0.iter(rtxn) + } } /// An iterator over mappings between requested internal ids and external ids. diff --git a/milli/src/update/index_documents/transform.rs b/milli/src/update/index_documents/transform.rs index 2eec69da5..7c500799d 100644 --- a/milli/src/update/index_documents/transform.rs +++ b/milli/src/update/index_documents/transform.rs @@ -799,7 +799,7 @@ impl<'a, 'i> Transform<'a, 'i> { let mut obkv_buffer = Vec::new(); let mut document_sorter_key_buffer = Vec::new(); let mut document_sorter_value_buffer = Vec::new(); - for result in self.index.external_documents_ids().0.iter(wtxn)? { + for result in self.index.external_documents_ids().iter(wtxn)? { let (external_id, docid) = result?; let obkv = self.index.documents.get(wtxn, &docid)?.ok_or( InternalError::DatabaseMissingEntry { db_name: db_name::DOCUMENTS, key: None },