From 5cfd3d8407bd2bc11f6771385436681726ea8e12 Mon Sep 17 00:00:00 2001 From: ad hoc Date: Tue, 5 Apr 2022 14:10:22 +0200 Subject: [PATCH] add exact attributes documentation --- milli/src/index.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/milli/src/index.rs b/milli/src/index.rs index c7441c590..42170bc80 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -964,6 +964,7 @@ impl Index { Ok(()) } + /// Returns the exact attributes: attributes for which typo is disallowed. pub fn exact_attributes<'t>(&self, txn: &'t RoTxn) -> Result> { Ok(self .main @@ -971,17 +972,20 @@ impl Index { .unwrap_or_default()) } + /// Returns the list of exact attributes field ids. pub fn exact_attributes_ids(&self, txn: &RoTxn) -> Result> { let attrs = self.exact_attributes(txn)?; let fid_map = self.fields_ids_map(txn)?; Ok(attrs.iter().filter_map(|attr| fid_map.id(attr)).collect()) } + /// Writes the exact attributes to the database. pub(crate) fn put_exact_attributes(&self, txn: &mut RwTxn, attrs: &[&str]) -> Result<()> { self.main.put::<_, Str, SerdeBincode<&[&str]>>(txn, main_key::EXACT_ATTRIBUTES, &attrs)?; Ok(()) } + /// Clears the exact attributes from the store. pub(crate) fn delete_exact_attributes(&self, txn: &mut RwTxn) -> Result<()> { self.main.delete::<_, Str>(txn, main_key::EXACT_ATTRIBUTES)?; Ok(())